Shape.CanFocus Property

 

Gets a value indicating whether a line or shape control can receive focus.

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

[BrowsableAttribute(false)]
public bool CanFocus { get; }

Property Value

Type: System.Boolean

true if the control can receive focus; otherwise, false. The default is true.

In order for a control to receive input focus, the Visible and Enabled properties must both be set to true for the control and all its parent controls.

To prevent an individual control from receiving focus, set its Enabled property to false.

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)
    {
        shape.Focus();
    }
}
Return to top
Show: