AccessibleObject.DefaultAction 屬性

定義

取得描述物件之預設動作的字串。Gets a string that describes the default action of the object. 並非所有的物件都有預設動作。Not all objects have a default action.

public:
 virtual property System::String ^ DefaultAction { System::String ^ get(); };
public virtual string DefaultAction { get; }
member this.DefaultAction : string
Public Overridable ReadOnly Property DefaultAction As String

屬性值

物件預設動作的描述;若此物件沒有預設動作,則為 nullA description of the default action for an object, or null if this object has no default action.

例外狀況

無法擷取控制項的預設動作。The default action for the control cannot be retrieved.

備註

此字串描述在物件上執行的動作,而不是物件的結果。The string describes the action that is performed on an object, not what the object does as a result. 也就是說,列印檔案的工具列按鈕有預設動作 [按下],而不是 [列印目前檔]。That is, a toolbar button that prints a document has a default action of "Press" rather than "Prints the current document." 請勿混淆物件的預設動作及其值。Do not confuse an object's default action with its value.

給繼承者的注意事項

如果物件包裝具有預設動作的系統控制項,則預設的執行會傳回可存取物件的預設動作;否則,它會傳回 nullThe default implementation returns the accessible object's default action if the object wraps a system control that has a default action; otherwise, it returns null. 只有執行動作的控制項才支援這個方法。Only controls that perform actions should support this method. 並非所有的物件都有預設動作,而且某些物件可能具有與其 Value 屬性相關的預設動作,如下列範例所示:選取的核取方塊具有預設動作「取消核取」和「已檢查」的值。Not all objects have default actions, and some objects might have a default action that is related to its Value property, such as in the following examples: A selected check box has a default action of "Uncheck" and a value of "Checked." [已清除] 核取方塊的預設動作為 [檢查],而值為 [未核取]。A cleared check box has a default action of "Check" and a value of "Unchecked." 標示為「列印」的按鈕具有預設動作「按下」,沒有值。A button labeled "Print" has a default action of "Press," with no value. 顯示「印表機」的靜態文字控制項或編輯控制項沒有預設動作,但其值為「印表機」。A static text control or an edit control that shows "Printer" has no default action, but would have a value of "Printer." 物件的 DefaultAction 屬性應該是動詞或簡短的動詞片語。An object's DefaultAction property should be a verb or a short verb phrase.

適用於

另請參閱