ToolStripItem.OnMouseLeave(EventArgs) メソッド

定義

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

protected:
 virtual void OnMouseLeave(EventArgs ^ e);
protected virtual void OnMouseLeave(EventArgs e);
abstract member OnMouseLeave : EventArgs -> unit
override this.OnMouseLeave : EventArgs -> unit
Protected Overridable Sub OnMouseLeave (e As EventArgs)

パラメーター

e
EventArgs

イベント データを含む EventArgs

次のコード例は、 OnMouseLeave メソッドをオーバーライドする方法を示しています。 このコード例は、 ToolStripItem クラスに提供されるより大きな例の一部です。

// This method defines the behavior of the MouseLeave event.
// It sets the state of the rolloverValue field to false and
// tells the control to repaint.
protected override void OnMouseLeave(EventArgs e)
{
    base.OnMouseLeave(e);

    this.rolloverValue = false;

    this.Invalidate();
}
' This method defines the behavior of the MouseLeave event.
' It sets the state of the rolloverValue field to false and
' tells the control to repaint.
Protected Overrides Sub OnMouseLeave(e As EventArgs)
   MyBase.OnMouseLeave(e)
   
   Me.rolloverValue = False
   
   Me.Invalidate()
 End Sub

注釈

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

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

注意 (継承者)

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

適用対象