DataGridViewCell.OnMouseLeave(Int32) メソッド

定義

マウス ポインターをセルから離すと呼び出されます。

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)

パラメーター

rowIndex
Int32

セルの親行のインデックス。

次のコード例は、このメソッドの使用方法を示しています。 この例は、「How to: Customize Cells and Columns in the Windows フォーム 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

注釈

このメソッドは、 メソッドに DataGridView.OnCellMouseLeave 似ています。 イベントが発生した DataGridView.CellMouseLeave のと同じ状況で呼び出されますが、実際にはイベントは発生しません。

適用対象

こちらもご覧ください