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)

public event EventHandler MouseHover

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 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.";
Return to top