共用方式為


ButtonBase.IsDefault 屬性

定義

會取得或設定一個值,表示按鈕控制是否為預設按鈕。

protected:
 property bool IsDefault { bool get(); void set(bool value); };
protected public:
 property bool IsDefault { bool get(); void set(bool value); };
protected bool IsDefault { get; set; }
protected internal bool IsDefault { get; set; }
member this.IsDefault : bool with get, set
Protected Property IsDefault As Boolean
Protected Friend Property IsDefault As Boolean

屬性值

true如果按鈕控制是預設按鈕;否則,。 false

備註

當屬性 IsDefault 設定為 true時,按鈕即為 的預設按鈕 Form。 這表示當按下 Enter 鍵時,若沒有其他按鈕或控制鍵能捕捉 ENTER 鍵的對焦,該按鈕會被按下。

要指定表單的預設按鈕,請將該表單的屬性設 AcceptButton 為所需的按鈕。

適用於

另請參閱