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

屬性值

Boolean

如果按鈕控制項為預設按鈕,則為 true,否則為 false

備註

IsDefault當 屬性設定為 true 時,按鈕是 的預設按鈕 Form 。 這表示當沒有其他按鈕或擷取 ENTER 鍵的任何其他控制項具有焦點時,就會按下 ENTER 鍵。

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

適用於

另請參閱