RadioButton 构造函数

定义

初始化 RadioButton 类的新实例。

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

示例

下面的代码示例创建并初始化一个 RadioButton,为它提供切换按钮的外观,将其 AutoCheck 属性设置为 false,并将其添加到 a 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

适用于