Shape.MouseHover 事件
更新:2007 年 11 月
当鼠标指针停留在形状上时发生。
命名空间: Microsoft.VisualBasic.PowerPacks
程序集: Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
语法
声明
<BrowsableAttribute(True)> _
Public Event MouseHover As EventHandler
用法
Dim instance As Shape
Dim handler As EventHandler
AddHandler instance.MouseHover, handler
[BrowsableAttribute(true)]
public event EventHandler MouseHover
[BrowsableAttribute(true)]
public:
event EventHandler^ MouseHover {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
JScript 不支持事件。
备注
MouseHover 的一个典型用法是,当鼠标暂停在形状周围的指定区域(悬停矩形)中时显示一个工具提示。 引发此事件所需的暂停时间是由 MouseHoverTime 属性指定的(以毫秒为单位)。
MouseHover 事件的定义和检测是与 MouseHoverSize 和 MouseHoverTime 属性相关联的。
鼠标事件按以下顺序发生:
MouseHover / MouseDown / MouseWheel
有关如何处理事件的更多信息,请参见使用事件。
示例
下面的示例会在鼠标移过形状时在状态栏中显示一条消息。 此示例要求窗体上有一个名为 RectangleShape1 的 RectangleShape 控件和一个名为 StatusStrip1 的 StatusStrip 控件。 StatusStrip 必须有一个名为 ToolStripStatusLabel1 的 ToolStripStatusLabel。
Private Sub RectangleShape1_MouseEnter(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles RectangleShape1.MouseEnter
ToolStripStatusLabel1.Text = "The mouse has entered the shape."
End Sub
Private Sub RectangleShape1_MouseHover(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles RectangleShape1.MouseHover
ToolStripStatusLabel1.Text = "The mouse is paused over the shape."
End Sub
Private Sub RectangleShape1_MouseLeave(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles RectangleShape1.MouseLeave
ToolStripStatusLabel1.Text = "The mouse has left the shape."
End Sub
Private Sub RectangleShape1_MouseMove(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) 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.";
}
权限
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
另请参见
参考
Microsoft.VisualBasic.PowerPacks 命名空间
其他资源
如何:使用 LineShape 控件绘制直线 (Visual Studio)