DataGridViewCell.OnMouseEnter(Int32) Metoda

Definicja

Wywoływane, gdy wskaźnik myszy przesuwa się nad komórką.

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)

Parametry

rowIndex
Int32

Indeks wiersza nadrzędnego komórki.

Przykłady

Poniższy przykład kodu ilustruje użycie tej metody. Ten przykład jest częścią większego przykładu dostępnego w temacie How to: Customize Cells and Columns in the Windows Forms DataGridView control (Dostosowywanie komórek i kolumn w kontrolce DataGridView), rozszerzając ich zachowanie i wygląd.

// 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

Uwagi

Ta metoda jest podobna DataGridView.OnCellMouseEnter do metody . Jest wywoływana w tych samych okolicznościach, w których DataGridView.CellMouseEnter jest zgłaszane zdarzenie, ale w rzeczywistości nie zgłasza zdarzenia.

Dotyczy

Zobacz też