DataGridViewCell.OnMouseLeave(Int32) Metoda

Definicja

Wywoływana, gdy wskaźnik myszy opuszcza komórkę.

protected:
 virtual void OnMouseLeave(int rowIndex);
protected virtual void OnMouseLeave (int rowIndex);
abstract member OnMouseLeave : int -> unit
override this.OnMouseLeave : int -> unit
Protected Overridable Sub OnMouseLeave (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.OnCellMouseLeave do metody . Jest wywoływana w tych samych okolicznościach, w których DataGridView.CellMouseLeave jest zgłaszane zdarzenie, ale w rzeczywistości nie zgłasza zdarzenia.

Dotyczy

Zobacz też