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

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property CanFocus As Boolean
[BrowsableAttribute(false)]
public bool CanFocus { get; }
[BrowsableAttribute(false)]
public:
property bool CanFocus {
    bool get ();
}
[<BrowsableAttribute(false)>]
member CanFocus : bool with get
function get CanFocus () : 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 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
public void ShapeSetFocus(Microsoft.VisualBasic.PowerPacks.Shape shape)
{
    // Set focus to the control, if it can receive focus. 
    if (shape.CanFocus)
    {
        shape.Focus();
    }
}

.NET Framework Security

See Also

Reference

Shape Class

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)

Introduction to the Line and Shape Controls (Visual Studio)