DataGridViewCellEventArgs Class
Provides data for DataGridView events related to cell and row operations.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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.
Private Sub dataGridView1_CellMouseEnter(ByVal sender As Object, _ ByVal e As DataGridViewCellEventArgs) _ Handles dataGridView1.CellMouseEnter Dim markingUnderMouse As Bitmap = _ CType(dataGridView1.Rows(e.RowIndex). _ Cells(e.ColumnIndex).Value, Bitmap) If markingUnderMouse Is blank Then dataGridView1.Cursor = Cursors.Default ElseIf markingUnderMouse Is o OrElse markingUnderMouse Is x Then dataGridView1.Cursor = Cursors.No ToolTip(e) End If End Sub Private Sub ToolTip( _ ByVal e As DataGridViewCellEventArgs) Dim cell As DataGridViewImageCell = _ CType(dataGridView1.Rows(e.RowIndex). _ Cells(e.ColumnIndex), DataGridViewImageCell) Dim imageColumn As DataGridViewImageColumn = _ CType(dataGridView1.Columns(cell.ColumnIndex), _ DataGridViewImageColumn) cell.ToolTipText = imageColumn.Description End Sub Private Sub dataGridView1_CellMouseLeave(ByVal sender As Object, _ ByVal e As DataGridViewCellEventArgs) _ Handles dataGridView1.CellMouseLeave dataGridView1.Cursor = Cursors.Default End Sub
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.