| Visual Basic (Declaration) | |
|---|---|
Public Overridable Property CanFocus As Boolean | |
| Visual Basic (Usage) | Copy Code |
|---|---|
| |
| C# | |
|---|---|
public virtual bool CanFocus {get; set;} | |
Return Value
Boolean value: true if element can receive focus; false otherwise| C# | Copy Code |
|---|---|
control.Picture = Image.FromFile(Application.StartupPath + "\\smokes.bmp"); | |
| Visual Basic | Copy Code |
|---|---|
control.Picture = Image.FromFile(Application.StartupPath & "\smokes.bmp") | |
If this property is set to true, you can check whether the control has the focus, or move the focus to the control, by calling the Focus method or check whether the control has the focus using the Focused property.
If you do not want the control to receive focus nor for the user to interact with it, set the Enabled property to false.
For some controls, when the control receives the focus, if it can, the control can display a focus rectangle. Specify whether and how the focus rectangle appears by setting the DrawFocusRectangle property.
Some controls display a cursor when they receive the focus. Specify the position of the cursor by setting the EditModeCursorPosition property.
Contrast this property with the Enabled property and the Selectable property. Use the Enabled property to specify whether the control looks grayed and users can interact with it. Use the Selectable property to specify whether users can interact with the control, such as pressing a button.