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.

适用于

另请参阅