Control.ContainsFocus Control.ContainsFocus Control.ContainsFocus Control.ContainsFocus Property

定义

获取一个值,该值指示控件或它的一个子控件当前是否有输入焦点。Gets a value indicating whether the control, or one of its child controls, currently has the input focus.

public:
 property bool ContainsFocus { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool ContainsFocus { get; }
member this.ContainsFocus : bool
Public ReadOnly Property ContainsFocus As Boolean

属性值

如果控件或它的一个子控件当前已经有输入焦点,则为 true;否则为 falsetrue if the control or one of its child controls currently has the input focus; otherwise, false.

注解

此属性可用于确定控件或任何它所包含的控件是否具有输入的焦点。You can use this property to determine whether a control or any of the controls contained within it has the input focus. 若要确定是否在控件有焦点,而不考虑任何子控件是否有焦点时,使用Focused属性。To determine whether the control has focus, regardless of whether any of its child controls have focus, use the Focused property. 若要为控件提供输入的焦点,请使用FocusSelect方法。To give a control the input focus, use the Focus or Select methods.

适用于

另请参阅