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
'宣言
<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:
MouseHover / MouseDown / MouseWheel
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
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)