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 ReadOnly Property CanFocus As Boolean
Get
'الاستخدام
Dim instance As Shape
Dim value As Boolean
value = instance.CanFocus
[BrowsableAttribute(false)]
public bool CanFocus { get; }
[BrowsableAttribute(false)]
public:
property bool CanFocus {
bool get ();
}
[<BrowsableAttribute(false)>]
member CanFocus : bool
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
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)