Share via


DataGridViewCell.OnMouseLeave(Int32) Metode

Definisi

Dipanggil saat penunjuk mouse meninggalkan sel.

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)

Parameter

rowIndex
Int32

Indeks baris induk sel.

Contoh

Contoh kode berikut mengilustrasikan penggunaan metode ini. Contoh ini adalah bagian dari contoh yang lebih besar yang tersedia di Cara: Menyesuaikan Sel dan Kolom di kontrol Formulir Windows DataGridView dengan Memperluas Perilaku dan Tampilannya.

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

Keterangan

Metode ini mirip DataGridView.OnCellMouseLeave dengan metode . Ini dipanggil dalam keadaan yang sama di mana peristiwa DataGridView.CellMouseLeave dinaikkan, tetapi tidak benar-benar menaikkan acara.

Berlaku untuk

Lihat juga