Compartir a través de


Shape.MouseHover Event

Occurs when the mouse pointer rests on the shape.

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

Syntax

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

Remarks

A typical use of MouseHover is to display a tooltip when the mouse pauses in a specified area around the shape (the hover rectangle). The pause required for this event to be raised is specified in milliseconds by the MouseHoverTime property.

The MouseHover event is defined and detected in connection with the MouseHoverSize and MouseHoverTime properties.

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)