Share via


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)

Syntax

[BrowsableAttribute(false)]
public bool CanFocus { get; }
public:
[BrowsableAttribute(false)]
property bool CanFocus {
    bool get();
}
[<BrowsableAttribute(false)>]
member CanFocus : bool with get
<BrowsableAttribute(False)>
Public ReadOnly Property CanFocus As Boolean

Property Value

Type: System.Boolean

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

Remarks

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.

Examples

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();
    }
}
Public Sub ShapeSetFocus(ByVal shape As Microsoft.VisualBasic.PowerPacks.Shape)
    ' Set focus to the control, if it can receive focus.
    If shape.CanFocus Then
        shape.Focus()
    End If
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