Shape.Focus Method ()


Sets input focus to a line or shape control.

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

public bool Focus()

Return Value

Type: System.Boolean

true if the input focus request was successful; otherwise, false.

The Focus method returns true if the control successfully received input focus. A control can be selected and receive input focus if all the following are true: the control is visible and enabled, it is contained in another control, and all its parent controls are both visible and enabled.


Focus is a low-level method intended primarily for custom control authors. Developers should use the Select method or the ActiveControl property for child controls.

The following example sets the focus to the specified Shape, if it can receive focus.

public void ShapeSetFocus(Microsoft.VisualBasic.PowerPacks.Shape shape)
    // Set focus to the control, if it can receive focus.
    if (shape.CanFocus)
Return to top