Evento Shape.MouseEnter

Aggiornamento: novembre 2007

Viene generato quando il puntatore del mouse entra nella forma.

Spazio dei nomi:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintassi

<BrowsableAttribute(True)> _
Public Event MouseEnter As EventHandler

Dim instance As Shape
Dim handler As EventHandler

AddHandler instance.MouseEnter, handler
[BrowsableAttribute(true)]
public event EventHandler MouseEnter
[BrowsableAttribute(true)]
public:
 event EventHandler^ MouseEnter {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
JScript non supporta gli eventi.

Note

Gli eventi mouse si verificano nel seguente ordine:

MouseEnter

MouseMove

MouseHover / MouseDown / MouseWheel

MouseUp

MouseLeave

Per ulteriori informazioni sulle modalità di gestione degli eventi, vedere Utilizzo degli eventi.

Esempi

Nell'esempio riportato di seguito viene visualizzato un messaggio nella barra di stato quando il mouse viene spostato su una forma. Per questo esempio è necessario disporre in un form di un controllo RectangleShape denominato RectangleShape1 e di un controllo StatusStrip denominato StatusStrip1. StatusStrip deve disporre di un oggetto ToolStripStatusLabel denominato ToolStripStatusLabel1.

Private Sub RectangleShape1_MouseEnter(ByVal sender As Object, _
 ByVal e As System.EventArgs) Handles RectangleShape1.MouseEnter
    ToolStripStatusLabel1.Text = "The mouse has entered the shape."
End Sub

Private Sub RectangleShape1_MouseHover(ByVal sender As Object, _
  ByVal e As System.EventArgs) Handles RectangleShape1.MouseHover
    ToolStripStatusLabel1.Text = "The mouse is paused over the shape."
End Sub

Private Sub RectangleShape1_MouseLeave(ByVal sender As Object, _
  ByVal e As System.EventArgs) Handles RectangleShape1.MouseLeave
    ToolStripStatusLabel1.Text = "The mouse has left the shape."
End Sub

Private Sub RectangleShape1_MouseMove(ByVal sender As Object, _
  ByVal e As System.Windows.Forms.MouseEventArgs) Handles _
  RectangleShape1.MouseMove
    ToolStripStatusLabel1.Text = "The mouse is over the shape."
End Sub
private void rectangleShape1_MouseEnter(object sender, System.EventArgs e)
{
    toolStripStatusLabel1.Text = "The mouse has entered the shape.";
}

private void rectangleShape1_MouseHover(object sender, System.EventArgs e)
{
    toolStripStatusLabel1.Text = "The mouse is paused over the shape.";
}

private void rectangleShape1_MouseLeave(object sender, System.EventArgs e)
{
    toolStripStatusLabel1.Text = "The mouse has left the shape.";
}

private void rectangleShape1_MouseMove(object sender, 
    System.Windows.Forms.MouseEventArgs e)
{
    toolStripStatusLabel1.Text = "The mouse is over the shape.";
}

Autorizzazioni

Vedere anche

Riferimenti

Shape Classe

Membri Shape

Spazio dei nomi Microsoft.VisualBasic.PowerPacks

Altre risorse

Procedura: disegnare linee con il controllo LineShape (Visual Studio)

Procedura: disegnare forme con i controlli OvalShape e RectangleShape (Visual Studio)

Introduzione ai controlli Line e Shape (Visual Studio)