Shape.Leave 事件

更新:2007 年 11 月

当输入焦点离开形状时发生。

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

语法

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

AddHandler instance.Leave, handler
[BrowsableAttribute(true)]
public event EventHandler Leave
[BrowsableAttribute(true)]
public:
 event EventHandler^ Leave {
    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

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

示例

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

Private Sub RectangleShape1_Leave(ByVal sender As Object, _
 ByVal e As System.EventArgs) Handles RectangleShape1.Leave
    ' Restore the default BackColor.
    RectangleShape1.BackColor = PowerPacks.SimpleShape.DefaultBackColor
End Sub
private void rectangleShape1_Leave(object sender, System.EventArgs e)
{
    // Restore the default BackColor.
    rectangleShape1.BackColor = SimpleShape.DefaultBackColor;
}

权限

另请参见

参考

Shape 类

Shape 成员

Microsoft.VisualBasic.PowerPacks 命名空间

其他资源

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

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

Line 和 Shape 控件简介 (Visual Studio)