Shape.LostFocus Event
Occurs when the shape loses focus.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
'إقرار
<BrowsableAttribute(True)> _
Public Event LostFocus As EventHandler
'الاستخدام
Dim instance As Shape
Dim handler As EventHandler
AddHandler instance.LostFocus, handler
[BrowsableAttribute(true)]
public event EventHandler LostFocus
[BrowsableAttribute(true)]
public:
event EventHandler^ LostFocus {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member LostFocus : 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(Shape, Boolean, Boolean, Boolean, Boolean) method, focus events occur in the following order:
LostFocus
When you change the focus by using the mouse or by calling the Focus method, focus events occur in the following order:
LostFocus
For more information about how to handle events, see Consuming Events.
ملاحظة
Do not try to set focus in the LostFocus event handler. Doing so can cause your application or the operating system to stop responding.
Examples
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 Sub RectangleShape1_LostFocus() Handles RectangleShape1.LostFocus
' Restore the default BorderColor.
RectangleShape1.BorderColor =
PowerPacks.SimpleShape.DefaultBorderColor
End Sub
private void rectangleShape1_LostFocus(object sender, System.EventArgs e)
{
// Restore the default BorderColor.
rectangleShape1.BorderColor = SimpleShape.DefaultBorderColor;
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
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)