Shape.Leave Event

Occurs when the input focus leaves the shape.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Event Leave As EventHandler
[BrowsableAttribute(true)]
public event EventHandler Leave
[BrowsableAttribute(true)]
public:
 event EventHandler^ Leave {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member Leave : IEvent<EventHandler,
    EventArgs>
JScript does not support events.

Remarks

When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on), or by calling the Select or SelectNextControl method, focus events occur in the following order:

Enter

GotFocus

Leave

LostFocus

When you change the focus by using the mouse or by calling the Focus method, focus events occur in the following order:

Enter

GotFocus

LostFocus

Leave

For more information about how to handle events, see Consuming Events.

Examples

The following example shows how to respond to the Leave event in an event handler. This example requires that you have a RectangleShape control named RectangleShape1 on a form.

Private Sub RectangleShape1_Leave() 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;
}

.NET Framework Security

See Also

Reference

Shape Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

How to: Draw Lines with the LineShape Control (Visual Studio)

How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)

Introduction to the Line and Shape Controls (Visual Studio)