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.

適用於

另請參閱