Export (0) Print
Expand All
Expand Minimize

DataGridView.CellToolTipTextNeeded Event

Occurs when a cell's ToolTip text is needed.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member CellToolTipTextNeeded : IEvent<DataGridViewCellToolTipTextNeededEventHandler,
    DataGridViewCellToolTipTextNeededEventArgs>

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

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

The 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 RowIndex properties to determine the state or value of a cell, and use this information to change or modify the DataGridViewCellToolTipTextNeededEventArgs.ToolTipText property. This property is initialized with the value of the cell ToolTipText property, which the event value overrides.

Handle the CellToolTipTextNeeded event when working with large amounts of data to avoid the performance penalties of setting the cell 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.

The following code example demonstrates how to use a CellToolTipTextNeeded event handler to display information from hidden columns in a data-bound DataGridView control.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft