次の方法で共有


RadioButton コンストラクタ

RadioButton クラスの新しいインスタンスを初期化します。

Public Sub New()
[C#]
public RadioButton();
[C++]
public: RadioButton();
[JScript]
public function RadioButton();

解説

RadioButton の既定の表示では、ボタンの右側にテキストが配置され、 AutoCheck プロパティは true に設定されます。

使用例

[Visual Basic, C#, C++] RadioButton を作成および初期化し、トグル ボタンのような外観にする例を次に示します。そのトグル ボタンの AutoCheck プロパティを false に設定し、トグル ボタンを Form に追加します。

 
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


[C#] 
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);
}


[C++] 
private:
    void InitializeMyRadioButton() {
        // Create and initialize a new RadioButton. 
        RadioButton __gc *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);
    };

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

RadioButton クラス | RadioButton メンバ | System.Windows.Forms 名前空間