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

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

次のコード例は、このメソッドの使用方法を示しています。 この例は、「方法: Windows フォーム DataGridView コントロールのセルと列をカスタマイズする方法」で使用できる、より大きな例の一部です。その動作と外観を拡張することで

// 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 イベントが発生したのと同じ状況で呼び出されますが、実際にはイベントは発生しません。

適用対象

こちらもご覧ください