共用方式為


RadioButton 建構函式

定義

初始化 RadioButton 類別的新執行個體。

public:
 RadioButton();
public RadioButton();
Public Sub New ()

範例

以下程式碼範例會建立並初始化 一個 RadioButton,使其看起來像是一個切換按鈕,將其屬性設 AutoCheckfalse,並將它加入一個 Form

private void InitializeMyRadioButton()
{
   // Create and initialize a new RadioButton.
   RadioButton radioButton1 = new RadioButton();

   // Make the radio button control appear as a toggle button.
   radioButton1.Appearance = Appearance.Button;

   // Turn off the update of the display on the click of the control.
   radioButton1.AutoCheck = false;

   // Add the radio button to the form.
   Controls.Add(radioButton1);
}
Private Sub InitializeMyRadioButton()
    ' Create and initialize a new RadioButton. 
    Dim radioButton1 As New RadioButton()
       
    ' Make the radio button control appear as a toggle button.
    radioButton1.Appearance = Appearance.Button
       
    ' Turn off the update of the display on the click of the control.
    radioButton1.AutoCheck = False
       
    ' Add the radio button to the form.
    Controls.Add(radioButton1)
End Sub

備註

預設視圖 RadioButton 的文字對齊在按鈕的右側,屬性 AutoCheck 設定為 true

適用於