Shape.MouseEnter 事件

,当鼠标指针进入形状,发生。

命名空间:  Microsoft.VisualBasic.PowerPacks
程序集:  Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

语法

声明
<BrowsableAttribute(True)> _
Public Event MouseEnter As EventHandler
[BrowsableAttribute(true)]
public event EventHandler MouseEnter
[BrowsableAttribute(true)]
public:
 event EventHandler^ MouseEnter {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member MouseEnter : IEvent<EventHandler,
    EventArgs>
JScript 不支持事件。

备注

鼠标事件按以下顺序发生:

MouseEnter

MouseMove

MouseHover / MouseDown / MouseWheel

MouseUp

MouseLeave

有关如何处理事件的更多信息,请参见使用事件

示例

,当鼠标移动在形状时,下面的示例演示在状态栏中显示一条消息。 此示例要求您具有一个 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 安全性

请参见

参考

Shape 类

Microsoft.VisualBasic.PowerPacks 命名空间

其他资源

如何:使用 LineShape 控件绘制直线 (Visual Studio)

如何:使用 OvalShape 和 RectangleShape 控件绘制形状 (Visual Studio)

Line 和 Shape 控件简介 (Visual Studio)