Export (0) Print
Expand All

Shape.LostFocus Event

Occurs when the shape loses focus.

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

[BrowsableAttribute(true)]
public event EventHandler LostFocus

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.

NoteNote

Do not try to set focus in the LostFocus event handler. Doing so can cause your application or the operating system to stop responding.

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

        private void rectangleShape1_LostFocus(object sender, System.EventArgs e)
        {
            // Restore the default BorderColor.
            rectangleShape1.BorderColor = SimpleShape.DefaultBorderColor;
        }

Show:
© 2014 Microsoft