次の方法で共有


GroupBox コンストラクタ

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

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

解説

既定では、新しい GroupBox が作成されると TabStop プロパティは false に設定されます。グループ ボックスの初期設定の大きさは、高さ 100 ピクセル、幅 200 ピクセルです。

使用例

GroupBox と 2 つの RadioButton コントロールをインスタンス化および作成する例を次に示します。オプション ボタンはグループ ボックスに追加され、グループ ボックスは Form に追加されます。

 
Private Sub InitializeMyGroupBox()
   ' Create and initialize a GroupBox and two RadioButton controls.
   Dim groupBox1 As New GroupBox()
   Dim radioButton1 As New RadioButton()
   Dim radioButton2 As New RadioButton()

   ' Set the FlatStyle of the GroupBox.
   groupBox1.FlatStyle = FlatStyle.System    
        
   ' Add the RadioButtons to the GroupBox.
   groupBox1.Controls.Add(radioButton1)
   groupBox1.Controls.Add(radioButton2)
        
   ' Add the GroupBox to the Form.
    Controls.Add(groupBox1)
End Sub 'InitializeMyGroupBox

[C#] 
private void InitializeMyGroupBox()
{
   // Create and initialize a GroupBox and two RadioButton controls.
   GroupBox groupBox1 = new GroupBox();
   RadioButton radioButton1 = new RadioButton();
   RadioButton radioButton2 = new RadioButton();

   // Set the FlatStyle of the GroupBox.
   groupBox1.FlatStyle = FlatStyle.System;
 
   // Add the RadioButtons to the GroupBox.
   groupBox1.Controls.Add(radioButton1);
   groupBox1.Controls.Add(radioButton2);
 
   // Add the GroupBox to the Form.
   Controls.Add(groupBox1);
}
 

[C++] 
private:
    void InitializeMyGroupBox() {
        // Create and initialize a GroupBox and two RadioButton controls.
        GroupBox __gc *groupBox1 = new GroupBox();
        RadioButton __gc *radioButton1 = new RadioButton();
        RadioButton __gc *radioButton2 = new RadioButton();
     
        // Add the RadioButtons to the GroupBox.
        groupBox1->Controls->Add(radioButton1);
        groupBox1->Controls->Add(radioButton2);
 
        // Add the GroupBox to the Form.
        Controls->Add(groupBox1);
    };
 

[JScript] 
function InitializeMyGroupBox(){
   // Create and initialize a GroupBox and two RadioButton controls.
   var groupBox1 : GroupBox = new GroupBox()
   var radioButton1 : RadioButton = new RadioButton()
   var radioButton2 : RadioButton = new RadioButton()

   // Set the FlatStyle of the GroupBox.
   groupBox1.FlatStyle = FlatStyle.System    
        
   // Add the RadioButtons to the GroupBox.
   groupBox1.Controls.Add(radioButton1)
   groupBox1.Controls.Add(radioButton2)
        
   // Add the GroupBox to the Form.
    Controls.Add(groupBox1)
}

必要条件

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

参照

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