AccessibleObject.GetFocused 方法

定義

擷取具有鍵盤焦點的物件。Retrieves the object that has the keyboard focus.

public:
 virtual System::Windows::Forms::AccessibleObject ^ GetFocused();
public virtual System.Windows.Forms.AccessibleObject GetFocused ();
abstract member GetFocused : unit -> System.Windows.Forms.AccessibleObject
override this.GetFocused : unit -> System.Windows.Forms.AccessibleObject
Public Overridable Function GetFocused () As AccessibleObject

傳回

AccessibleObject,指定目前焦點集中的子系。An AccessibleObject that specifies the currently focused child. 如果物件本身是集中的焦點,這個方法會傳回呼叫物件。This method returns the calling object if the object itself is focused. 如果沒有物件有焦點,則傳回 nullReturns null if no object has focus.

例外狀況

無法擷取控制項。The control cannot be retrieved.

備註

鍵盤焦點的概念與使用中視窗的概念有關。The concept of keyboard focus is related to that of an active window. 使用中視窗是使用者在其中工作的前景視窗。An active window is the foreground window in which the user is working. 具有鍵盤焦點的物件是使用中視窗或作用中視窗的子物件。The object with the keyboard focus is either the active window or a child object of the active window.

只有一個容器中的一個或多個物件,才可以將焦點放在任何一次。Only one object or item within a container can have the focus at any one time. 具有鍵盤焦點的物件不一定是選取的物件。The object with the keyboard focus is not necessarily the selected object.

給繼承者的注意事項

所有可接收鍵盤焦點的物件都必須支援此屬性。All objects that can receive the keyboard focus must support this property.

適用於

另請參閱