更新 : 2007 年 11 月
キャプション付きコントロールまたはキャプションなしコントロールのグループの周りにフレームを表示する Windows コントロールを表します。
名前空間 :
System.Windows.Forms アセンブリ :
System.Windows.Forms (System.Windows.Forms.dll 内)
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class GroupBox _
Inherits Control
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
public class GroupBox : Control
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
[ComVisibleAttribute(true)]
public ref class GroupBox : public Control
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */
/** @attribute ComVisibleAttribute(true) */
public class GroupBox extends Control
public class GroupBox extends Control
GroupBox はキャプション付きコントロールまたはキャプションなしコントロールのグループの周りにフレームを表示します。GroupBox を使用して、フォーム上のコントロールのコレクションを論理的にグループ化します。グループ ボックスは、コントロールのグループを定義するために使用できるコンテナ コントロールです。
グループ ボックスは、一般的に RadioButton コントロールの論理グループを格納するために使用されます。2 つのグループ ボックスのそれぞれに複数のオプション ボタンがある場合、各ボタン グループで一度に選択できるボタンは 1 つだけで、設定されるオプション値もそれぞれ 1 つです。
Controls プロパティの Add メソッドを使用して、コントロールを GroupBox に追加できます。
GroupBox には、スクロール バーを表示できません。スクロール バーを表示できる GroupBox のようなコントロールが必要な場合には、Panel コントロールのトピックを参照してください。
GroupBox と 2 つの RadioButton コントロールをインスタンス化および作成するコード例を次に示します。オプション ボタンはグループ ボックスに追加され、グループ ボックスは Form に追加されます。
Private Sub InitializeMyGroupBox()
' Create and initialize a GroupBox and a Button control.
Dim groupBox1 As New GroupBox()
Dim button1 As New Button()
button1.Location = New Point(20, 10)
' Set the FlatStyle of the GroupBox.
groupBox1.FlatStyle = FlatStyle.Flat
' Add the Button to the GroupBox.
groupBox1.Controls.Add(button1)
' Add the GroupBox to the Form.
Controls.Add(groupBox1)
' Create and initialize a GroupBox and a Button control.
Dim groupBox2 As New GroupBox()
Dim button2 As New Button()
button2.Location = New Point(20, 10)
groupBox2.Location = New Point(0, 120)
' Set the FlatStyle of the GroupBox.
groupBox2.FlatStyle = FlatStyle.Standard
' Add the Button to the GroupBox.
groupBox2.Controls.Add(button2)
' Add the GroupBox to the Form.
Controls.Add(groupBox2)
End Sub
private void InitializeMyGroupBox()
{
// Create and initialize a GroupBox and a Button control.
GroupBox groupBox1 = new GroupBox();
Button button1 = new Button();
button1.Location = new Point(20,10);
// Set the FlatStyle of the GroupBox.
groupBox1.FlatStyle = FlatStyle.Flat;
// Add the Button to the GroupBox.
groupBox1.Controls.Add(button1);
// Add the GroupBox to the Form.
Controls.Add(groupBox1);
// Create and initialize a GroupBox and a Button control.
GroupBox groupBox2 = new GroupBox();
Button button2 = new Button();
button2.Location = new Point(20, 10);
groupBox2.Location = new Point(0, 120);
// Set the FlatStyle of the GroupBox.
groupBox2.FlatStyle = FlatStyle.Standard;
// Add the Button to the GroupBox.
groupBox2.Controls.Add(button2);
// Add the GroupBox to the Form.
Controls.Add(groupBox2);
}
System..::.Object
System..::.MarshalByRefObject
System.ComponentModel..::.Component
System.Windows.Forms..::.Control
System.Windows.Forms..::.GroupBox
Microsoft.Web.Management.Client.Win32..::.ManagementGroupBox
この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
.NET Framework
サポート対象 : 3.5、3.0、2.0、1.1、1.0
参照