简体   繁体   English

带有图像和工具提示的网格中的DataGridViewImageColumn

[英]DataGridViewImageColumn in Grid with Image and Tooltip

 DataGridViewImageColumn editCutomerCollumn = new DataGridViewImageColumn();
 editCutomerCollumn.Width = 32;
 editCutomerCollumn.HeaderText = "";
 editCutomerCollumn.ToolTipText = "Edit";
 editCutomerCollumn.Name = DataGridViewColumnNames.Customers.EDIT_BUTTON;
 editCutomerCollumn.Image = Properties.Resources.Edit20;
 _gridView.Columns.Add(editCutomerCollumn);

I want to use in Grid for the image Tooltip like 我想在Grid中使用图像工具提示,例如

 editCutomerCollumn.ToolTipText = "Edit";

but problem is that tooltip is on cell header not on image. 但是问题是工具提示不在单元格标题上,而在图像上。 Why? 为什么? Can I add tooltip on image on grid? 我可以在网格图像上添加工具提示吗?

The DataGridViewColumn.ToolTipText is meant for displaying tooltip on column headers. DataGridViewColumn.ToolTipText用于在列标题上显示工具提示。

The DataGridViewCell.ToolTipText is meant for displaying tooltip for each individual cells. DataGridViewCell.ToolTipText用于显示每个单个单元格的工具提示。 But you have to be careful as it has performance penalities. 但是您必须小心,因为它会影响性能。 If you are working with large amount of data and want to display tooltip then handle the DataGridView.CellToolTipTextNeeded event. 如果您正在处理大量数据,并且想要显示工具提示,请处理DataGridView.CellToolTipTextNeeded事件。

In my project we use to the column tooltip to hint what the column is meant for and cell tooltips, mainly in case of images to hint what does the image denotes. 在我的项目中,我们使用“列”工具提示来提示该列的含义以及单元格工具提示,主要是在使用图像的情况下提示该图像表示什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM