简体   繁体   中英

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

 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.

The DataGridViewCell.ToolTipText is meant for displaying tooltip for each individual cells. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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