ButtonBase.IsDefault 屬性

定義

取得或設定值,指出按鈕控制項是否為預設按鈕。Gets or sets a value indicating whether the button control is the default button.

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

屬性值

Boolean

如果按鈕控制項為預設按鈕,則為 true,否則為 falsetrue if the button control is the default button; otherwise, false.

備註

IsDefault 屬性設定為時 true ,這個按鈕就是的預設按鈕 FormWhen the IsDefault property is set to true, the button is the default button for the Form. 這表示當按下 ENTER 鍵時,如果沒有其他按鈕或任何其他可捕捉 ENTER 鍵的控制項具有焦點,則按下 ENTER 鍵時,就會按一下按鈕。This means that the button is clicked when the ENTER key is pressed if no other button or any other control that captures the ENTER key has focus.

若要指定表單的預設按鈕,請將 AcceptButton 表單的屬性設定為所需的按鈕。To specify the default button of a form, set the AcceptButton property of the form to the desired button.

適用於

另請參閱