Shape.GotFocus Event
Occurs when the shape receives focus.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
[BrowsableAttribute(false)]
public event EventHandler GotFocus
public:
[BrowsableAttribute(false)]
event EventHandler^ GotFocus {
void add(EventHandler^ value);
void remove(EventHandler^ value);
}
[<BrowsableAttribute(false)>]
member GotFocus : IEvent<EventHandler,
EventArgs>
<BrowsableAttribute(False)>
Public Event GotFocus As EventHandler
Remarks
When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on), or by calling the Select or M:Microsoft.VisualBasic.PowerPacks.Shape.SelectNextControl(Microsoft.VisualBasic.PowerPacks.Shape,System.Boolean,System.Boolean,System.Boolean,System.Boolean) method, focus events occur in the following order:
GotFocus
When you change the focus by using the mouse or by calling the Focus method, focus events occur in the following order:
GotFocus
For more information about how to handle events, see Handling and Raising Events.
Note
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 GotFocus event in an event handler. This example requires that you have a RectangleShape control named RectangleShape1 on a form.
private void rectangleShape1_GotFocus(object sender, System.EventArgs e)
{
rectangleShape1.SelectionColor = Color.Red;
}
Private Sub RectangleShape1_GotFocus(
) Handles RectangleShape1.GotFocus
RectangleShape1.SelectionColor = Color.Red
End Sub
See Also
Shape Class
Microsoft.VisualBasic.PowerPacks Namespace
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)
Return to top