ToolStripItem.OnMouseLeave(EventArgs) Metoda

Definicja

MouseLeave Zgłasza zdarzenie.

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)

Parametry

e
EventArgs

Element EventArgs zawierający dane zdarzenia.

Przykłady

W poniższym przykładzie kodu pokazano, jak zastąpić metodę OnMouseLeave . Ten przykład kodu jest częścią większego przykładu udostępnionego ToolStripItem dla klasy .

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

Uwagi

Podnoszenie zdarzenia wywołuje program obsługi zdarzeń przez delegata. Aby uzyskać więcej informacji, zobacz Obsługa i podnoszenie zdarzeń.

Metoda OnMouseLeave umożliwia również klasom pochodnym obsługę zdarzenia bez dołączania delegata. Jest to preferowana technika obsługi zdarzenia w klasie pochodnej.

Uwagi dotyczące dziedziczenia

Podczas zastępowania OnMouseLeave(EventArgs) w klasie pochodnej należy wywołać metodę klasy OnMouseLeave(EventArgs) bazowej, aby zarejestrowani delegaci odbierali zdarzenie.

Dotyczy