DataGridViewCell.OnMouseEnter(Int32) Metodo

Definizione

Chiamato quando il puntatore del mouse viene spostato su una cella.Called when the mouse pointer moves over a cell.

protected:
 virtual void OnMouseEnter(int rowIndex);
protected virtual void OnMouseEnter (int rowIndex);
abstract member OnMouseEnter : int -> unit
override this.OnMouseEnter : int -> unit
Protected Overridable Sub OnMouseEnter (rowIndex As Integer)

Parametri

rowIndex
Int32

Indice della riga padre della cella.The index of the cell's parent row.

Esempio

Nell'esempio di codice riportato di seguito viene illustrato l'utilizzo di questo metodo.The following code example illustrates the use of this method. Questo esempio fa parte di un esempio più ampio disponibile in procedura: personalizzare le celle e le colonne nel controllo Windows Form DataGridView estendendo il comportamento e l'aspetto.This example is part of a larger example available in How to: Customize Cells and Columns in the Windows Forms DataGridView Control by Extending Their Behavior and Appearance.

// Force the cell to repaint itself when the mouse pointer enters it.
protected override void OnMouseEnter(int rowIndex)
{
    this.DataGridView.InvalidateCell(this);
}

// Force the cell to repaint itself when the mouse pointer leaves it.
protected override void OnMouseLeave(int rowIndex)
{
    this.DataGridView.InvalidateCell(this);
}
' Force the cell to repaint itself when the mouse pointer enters it.
Protected Overrides Sub OnMouseEnter(ByVal rowIndex As Integer)
    Me.DataGridView.InvalidateCell(Me)
End Sub

' Force the cell to repaint itself when the mouse pointer leaves it.
Protected Overrides Sub OnMouseLeave(ByVal rowIndex As Integer)
    Me.DataGridView.InvalidateCell(Me)
End Sub

Commenti

Questo metodo è simile al DataGridView.OnCellMouseEnter metodo.This method is similar to the DataGridView.OnCellMouseEnter method. Viene chiamato nelle stesse circostanze in cui DataGridView.CellMouseEnter viene generato un evento, ma non genera effettivamente l'evento.It is called in the same circumstances in which a DataGridView.CellMouseEnter event is raised, but it does not actually raise the event.

Si applica a

Vedi anche