Compartir a través de


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)

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Event MouseEnter As EventHandler
[BrowsableAttribute(true)]
public event EventHandler MouseEnter
[BrowsableAttribute(true)]
public:
 event EventHandler^ MouseEnter {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member MouseEnter : IEvent<EventHandler,
    EventArgs>
JScript does not support events.

Remarks

Mouse events occur in the following order:

MouseEnter

MouseMove

MouseHover / MouseDown / MouseWheel

MouseUp

MouseLeave

For more information about how to handle events, see Consuming Events.

Examples

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 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
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.";
}

.NET Framework Security

See Also

Reference

Shape Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

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)