{"id":236977,"date":"2022-03-17T08:35:43","date_gmt":"2022-03-17T00:35:43","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=236977"},"modified":"2022-03-03T10:37:27","modified_gmt":"2022-03-03T02:37:27","slug":"data-view-tooltip","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/data-view-tooltip.html","title":{"rendered":"DataGridView\u8bbe\u7f6e\u5355\u5143\u683c\u7684\u63d0\u793a\u5185\u5bb9ToolTip\u8be6\u89e3"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8fd9\u7bc7\u6587\u7ae0\u4ecb\u7ecd\u4e86DataGridView\u8bbe\u7f6e\u5355\u5143\u683c\u63d0\u793a\u5185\u5bb9ToolTip\u7684\u65b9\u6cd5\uff0c\u6587\u4e2d\u901a\u8fc7\u793a\u4f8b\u4ee3\u7801\u4ecb\u7ecd\u7684\u975e\u5e38\u8be6\u7ec6\u3002\u5bf9\u5927\u5bb6\u7684\u5b66\u4e60\u6216\u5de5\u4f5c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u501f\u9274\u4ef7\u503c\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

ToolTip\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u5f53\u9f20\u6807\u79fb\u52a8\u5230\u5355\u5143\u683c\u4e0a\u9762\u65f6\u7684\u63d0\u793a\u5185\u5bb9\u3002<\/p>\n

DataGridView.ShowCellToolTips=True\u7684\u60c5\u51b5\u4e0b\uff0c\u5355\u5143\u683c\u7684ToolTip\u53ef\u4ee5\u8868\u793a\u51fa\u6765\u3002\u5bf9\u4e8e\u5355\u5143\u683c\u7a84\u5c0f\uff0c\u65e0\u6cd5\u5b8c\u5168\u663e\u793a\u7684\u5355\u5143\u683c\uff0cToolTip\u53ef\u4ee5\u663e\u793a\u5fc5\u8981\u7684\u4fe1\u606f\u3002<\/p>\n

\u793a\u4f8b1\uff1a\u8bbe\u5b9a\u5355\u5143\u683c\u7684ToolTip\u5185\u5bb9<\/p>\n

\/\/\u8bbe\u7f6e\u7b2c\u4e8c\u884c\u7b2c\u4e00\u5217\u7684\u63d0\u793a\u5185\u5bb9\r\nthis.dgv_PropDemo[0, 1].ToolTipText = \"\u8be5\u5355\u5143\u683c\u7684\u5185\u5bb9\u4e0d\u80fd\u4fee\u6539\";<\/pre>\n

\u8fd0\u884c\u6548\u679c\uff1a<\/p>\n

\"\"<\/a><\/p>\n

\u793a\u4f8b2\uff1a\u8bbe\u5b9a\u5217\u5934\u7684\u5355\u5143\u683c\u7684ToolTip\u5185\u5bb9\uff1a<\/p>\n

\/\/\u8bbe\u7f6e\u7b2c\u56db\u5217\u5217\u5934\u7684ToolTip\r\nthis.dgv_PropDemo.Columns[3].ToolTipText = \"\u8be5\u884c\u53ea\u80fd\u8f93\u5165\u7537\u6216\u5973\";<\/pre>\n

\u8fd0\u884c\u6548\u679c\uff1a<\/p>\n

\"\"<\/a><\/p>\n

\u793a\u4f8b3\uff1a\u8bbe\u5b9a\u884c\u5934\u7684\u5355\u5143\u683c\u7684ToopTip\u5185\u5bb9\uff1a<\/p>\n

\/\/\u8bbe\u7f6e\u7b2c\u4e00\u884c\u884c\u5934\u7684ToopTip\r\nthis.dgv_PropDemo.Rows[0].HeaderCell.ToolTipText = \"\u8be5\u884c\u5355\u5143\u683c\u7684\u5185\u5bb9\u4e0d\u80fd\u4fee\u6539\";<\/pre>\n

\u8fd0\u884c\u6548\u679c\uff1a<\/p>\n

\"\"<\/a><\/p>\n

CellToopTipTextNeeded\u4e8b\u4ef6<\/strong><\/div>\n

\u5728\u6279\u91cf\u7684\u5355\u5143\u683c\u7684ToolTip\u8bbe\u5b9a\u7684\u65f6\u5019\uff0c\u4e00\u4e2a\u4e00\u4e2a\u6307\u5b9a\u7684\u6548\u7387\u6bd4\u8f83\u4f4e\uff0c\u8fd9\u65f6\u5019\u53ef\u4ee5\u5229\u7528CellToopTipTextNeeded\u4e8b\u4ef6\u3002\u5f53\u5355\u5143\u683c\u7684ToopTipText\u53d8\u5316\u7684\u65f6\u5019\u4e5f\u4f1a\u5f15\u53d1\u8be5\u4e8b\u4ef6\u3002\u4f46\u662f\uff0c\u5f53DataGridView\u7684DataSource\u88ab\u6307\u5b9a\u4e14VirualMode=True\u7684\u65f6\u5019\uff0c\u8be5\u4e8b\u4ef6\u4e0d\u4f1a\u88ab\u5f15\u53d1\u3002<\/p>\n

private void dgv_PropDemo_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e)\r\n{\r\n     \/\/\u9f20\u6807\u5728\u7b2c\u4e09\u5217\u7684\u5355\u5143\u683c\u4e0a\u9762\u65f6\u663e\u793a\u63d0\u793a\u4fe1\u606f\r\n     if (e.ColumnIndex == 2)\r\n     {\r\n        e.ToolTipText = \"\u5217:\" + e.ColumnIndex.ToString() + \",\u884c:\" + e.RowIndex.ToString();\r\n     }\r\n}<\/pre>\n

\u8fd0\u884c\u6548\u679c\uff1a<\/p>\n

\"\"<\/a><\/p>\n

\u5230\u6b64\u8fd9\u7bc7\u5173\u4e8eDataGridView\u8bbe\u7f6e\u5355\u5143\u683c\u63d0\u793a\u5185\u5bb9ToolTip\u7684\u6587\u7ae0\u5c31\u4ecb\u7ecd\u5230\u8fd9\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

ToolTip\u5c5e\u6027\u7528\u6765\u8bbe\u7f6e\u5f53\u9f20\u6807\u79fb\u52a8\u5230\u5355\u5143\u683c\u4e0a\u9762\u65f6\u7684\u63d0\u793a\u5185\u5bb9\u3002 DataGridView.ShowCellTo […]<\/p>\n","protected":false},"author":1482,"featured_media":200666,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-236977","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/236977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=236977"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/236977\/revisions"}],"predecessor-version":[{"id":236985,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/236977\/revisions\/236985"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/200666"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=236977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=236977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=236977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}