System.Windows.Forms.DataGridViewCellToolTipTextNeededEventArgs Class

Provides data for the DataGridView.CellToolTipTextNeeded event.

See Also: DataGridViewCellToolTipTextNeededEventArgs Members


public class DataGridViewCellToolTipTextNeededEventArgs : DataGridViewCellEventArgs


The DataGridView.CellToolTipTextNeeded event occurs only when the System.Windows.Forms.DataGridView control DataGridView.DataSource property is set or its DataGridView.VirtualMode property is true.

When you handle the DataGridView.CellToolTipTextNeeded event, the ToolTip text you specify in the handler is shown whenever the mouse pointer is over a cell and the control DataGridView.ShowCellToolTips property value is true. The DataGridView.CellToolTipTextNeeded event is useful when you want to display ToolTips determined by the current state or value of a cell.

The DataGridView.CellToolTipTextNeeded event also occurs whenever the value of the DataGridViewCell.ToolTipText property is retrieved, either programmatically or when the mouse pointer enters a cell.

You can use the DataGridViewCellEventArgs.ColumnIndex and DataGridViewCellEventArgs.RowIndex properties to determine the state or value of a cell, and use this information to set the DataGridViewCellToolTipTextNeededEventArgs.ToolTipText property. This property is initialized with the value of the cell DataGridViewCell.ToolTipText property, which the event value overrides.

Handle the DataGridView.CellToolTipTextNeeded event when working with large amounts of data to avoid the performance penalties of setting the cell DataGridViewCell.ToolTipText value for multiple cells. For more information, see Best Practices for Scaling the Windows Forms DataGridView Control.

For more information about handling events, see Consuming Events.


Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions:
Since: .NET 2.0