Shape.MouseEnter Event


Occurs when the mouse pointer enters the shape.

Namespace:   Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)


public event EventHandler MouseEnter
event EventHandler^ MouseEnter {
    void add(EventHandler^ value);
    void remove(EventHandler^ value);
member MouseEnter : IEvent<EventHandler,
Public Event MouseEnter As EventHandler


Mouse events occur in the following order:



MouseHover / MouseDown / MouseWheel



For more information about how to handle events, see Handling and Raising Events.


The following example displays a message in the status bar when the mouse is moved over a shape. This example requires that you have a RectangleShape control named RectangleShape1 and a StatusStrip control named StatusStrip1 on a form. The StatusStrip must have a ToolStripStatusLabel named ToolStripStatusLabel1.

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.";
Private Sub RectangleShape1_MouseEnter(
  ) Handles RectangleShape1.MouseEnter

    ToolStripStatusLabel1.Text = "The mouse has entered the shape."
End Sub

Private Sub RectangleShape1_MouseHover(
  ) Handles RectangleShape1.MouseHover

    ToolStripStatusLabel1.Text = "The mouse is paused over the shape."
End Sub

Private Sub RectangleShape1_MouseLeave(
  ) Handles RectangleShape1.MouseLeave

    ToolStripStatusLabel1.Text = "The mouse has left the shape."
End Sub

Private Sub RectangleShape1_MouseMove(
  ) Handles RectangleShape1.MouseMove

    ToolStripStatusLabel1.Text = "The mouse is over the shape."
End Sub

See Also

Shape Class
Microsoft.VisualBasic.PowerPacks Namespace
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)
Introduction to the Line and Shape Controls (Visual Studio)

Return to top