Shape.Enter 事件

更新:2007 年 11 月

当进入形状时发生。

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

语法

声明
<BrowsableAttribute(True)> _
Public Event Enter As EventHandler
用法
Dim instance As Shape
Dim handler As EventHandler

AddHandler instance.Enter, handler
[BrowsableAttribute(true)]
public event EventHandler Enter
[BrowsableAttribute(true)]
public:
 event EventHandler^ Enter {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
JScript 不支持事件。

备注

当使用键盘(Tab、Shift+Tab 等)或者通过调用 Select 或 SelectNextControl(Shape, Boolean, Boolean, Boolean, Boolean) 方法更改焦点时,焦点事件将按以下顺序发生:

Enter

GotFocus

Leave

LostFocus

当使用鼠标或通过调用 Focus 方法更改焦点时,焦点事件将按以下顺序发生:

Enter

GotFocus

LostFocus

Leave

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

示例

下面的示例演示如何在事件处理程序中响应 Enter 事件。 此示例要求窗体上有一个名为 RectangleShape1 的 RectangleShape 控件。

Private Sub RectangleShape1_Enter(ByVal sender As Object, _
  ByVal e As System.EventArgs) Handles RectangleShape1.Enter
    MsgBox("The rectangle has been selected.")
End Sub
private void rectangleShape1_Enter(object sender, System.EventArgs e)
{
    MessageBox.Show("The rectangle has been selected.");
}

权限

另请参见

参考

Shape 类

Shape 成员

Microsoft.VisualBasic.PowerPacks 命名空间

其他资源

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

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

Line 和 Shape 控件简介 (Visual Studio)