DataGridViewCellEventArgs Class
Provides data for DataGridView events related to cell and row operations.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Name | Description | |
|---|---|---|
![]() | DataGridViewCellEventArgs(Int32, Int32) | Initializes a new instance of the DataGridViewCellEventArgs class. |
| Name | Description | |
|---|---|---|
![]() | ColumnIndex | Gets a value indicating the column index of the cell that the event occurs for. |
![]() | RowIndex | Gets a value indicating the row index of the cell that the event occurs for. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | MemberwiseClone() | |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
The DataGridViewCellEventArgs class provides data for the following DataGridView events:
The following code example demonstrates using CellMouseEnter and CellMouseLeave event handlers to determine whether a cell can be clicked. The example updates each ToolTipText property value to advertise the current image layout. This code is part of a larger example shown in How to: Work with Image Columns in the Windows Forms DataGridView Control.
void dataGridView1_CellMouseEnter( Object^ sender, DataGridViewCellEventArgs^ e ) { Bitmap^ markingUnderMouse = dynamic_cast<Bitmap^>(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]->Value); if ( markingUnderMouse == blank ) { dataGridView1->Cursor = Cursors::Default; } else if ( markingUnderMouse == o || markingUnderMouse == x ) { dataGridView1->Cursor = Cursors::No; ToolTip(e,true); } } void ToolTip( DataGridViewCellEventArgs^ e, bool showTip ) { DataGridViewImageCell^ cell = dynamic_cast<DataGridViewImageCell^>(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]); DataGridViewImageColumn^ imageColumn = dynamic_cast<DataGridViewImageColumn^>(dataGridView1->Columns[ cell->ColumnIndex ]); if ( showTip ) cell->ToolTipText = imageColumn->Description; else { cell->ToolTipText = String::Empty; } } void dataGridView1_CellMouseLeave( Object^ sender, DataGridViewCellEventArgs^ e ) { ToolTip( e, false ); dataGridView1->Cursor = Cursors::Default; }
Available since 2.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


