Visual Basic (Declaration) | |
---|---|
Public Overridable Property CanFocus As Boolean |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As ElementWindowless Dim value As Boolean instance.CanFocus = value value = instance.CanFocus |
C# | |
---|---|
public virtual bool CanFocus {get; set;} |
Property Value
Boolean value: true if element can receive focus; false otherwiseUse this property to specify whether an element can receive the focus.
If this property is true, you can check whether the element has the focus, or move the focus to the element, by calling the Focus method or check whether the element has the focus using the Focused property.
Specify whether and how the focus rectangle appears in the element by setting the DrawFocusRectangle property. Specify the position of the cursor when the element receives the focus by setting the EditModeCursorPosition property, if appropriate.
If you do not want the element to receive focus nor for the user to interact with it, set the Enabled property to false.
This property is available at run time only.
Contrast this property with the Selectable property and the Enabled property. Use the Selectable property to specify whether users can interact with the element. Use the Enabled property to specify whether the element looks grayed and users can interact with it.
csharp | Copy Code |
---|---|
private void button1_Click(object sender, System.EventArgs e) { element.Visible = true; element.Enabled = false; element.Selectable = false; element.CanFocus = false; } |
Visual Basic | Copy Code |
---|---|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click element.Visible = True element.Enabled = False element.Selectable = False element.CanFocus = False End Sub |
Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8