Shape.MouseHover 事件
,当鼠标指针停留形状,发生。
命名空间: Microsoft.VisualBasic.PowerPacks
程序集: Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
语法
声明
<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 不支持事件。
备注
为 MouseHover 的典型用途是显示工具提示,当鼠标位于指定的区域悬停在形状中 ( 悬停矩形) 附近。 引发此事件所需的暂停时间是由 MouseHoverTime 属性指定的(以毫秒为单位)。
MouseHover 事件的定义和检测是与 MouseHoverSize 和 MouseHoverTime 属性相关联的。
鼠标事件按以下顺序发生:
MouseHover / MouseDown / MouseWheel
有关如何处理事件的更多信息,请参见使用事件。
示例
,当鼠标移动在形状时,下面的示例演示在状态栏中显示一条消息。 此示例要求您具有一个 RectangleShape 控件 RectangleShape1 的、名为在窗体的 StatusStrip1 的一个 StatusStrip 控件。 StatusStrip 必须有名 ToolStripStatusLabel1 的 ToolStripStatusLabel 。
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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.VisualBasic.PowerPacks 命名空间
其他资源
如何:使用 LineShape 控件绘制直线 (Visual Studio)