DataGridView.OnMouseLeave(EventArgs) メソッド

定義

MouseLeave イベントを発生させます。

protected:
 override void OnMouseLeave(EventArgs ^ e);
protected override void OnMouseLeave(EventArgs e);
override this.OnMouseLeave : EventArgs -> unit
Protected Overrides Sub OnMouseLeave (e As EventArgs)

パラメーター

e
EventArgs

イベント データを含む EventArgs

次のコード例は、このメソッドの使用方法を示しています。 この例は、「方法: 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

注釈

イベントを発生させると、デリゲートを介してイベント ハンドラーが呼び出されます。 詳細については、「イベントの 処理と発生」を参照してください。

OnMouseLeave メソッドでは、デリゲートをアタッチせずに、派生クラスでイベントを処理することもできます。 これは、派生クラスでイベントを処理するために推奨される手法です。

注意 (継承者)

派生クラスで OnMouseLeave(EventArgs) をオーバーライドする場合は、登録されているデリゲートがイベントを受け取るように、基底クラスの OnMouseLeave(EventArgs) メソッドを必ず呼び出してください。

適用対象

こちらもご覧ください