共用方式為


RadioButton 建構函式

定義

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

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

範例

下列程式碼範例會建立並初始化 RadioButton ,提供切換按鈕的外觀、將其 AutoCheck 屬性設定為 false ,並將其新增至 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

適用於