DockStyle 列挙体
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
Public Enumeration DockStyle
メンバ名 | 説明 | |
---|---|---|
Bottom | 格納されるコントロールの下端は、格納する側のコントロールの下端にドッキングされます。 | |
Fill | 格納されるコントロールの四辺は、格納する側のコントロールの四辺にドッキングされ、適切なサイズに調節されます。 | |
Left | 格納されるコントロールの左端は、格納する側のコントロールの左端にドッキングされます。 | |
None | コントロールはドッキングされていません。 | |
Right | 格納されるコントロールの右端は、格納する側のコントロールの右端にドッキングされます。 | |
Top | 格納されるコントロールの上端は、格納する側のコントロールの上端にドッキングされます。 |
コントロールがコンテナの端にドッキングされた場合は、コンテナのサイズを変更しても常にコンテナに隣接した位置に配置されます。1 つ以上のコントロールがコンテナの端にドッキングされた場合、コントロールはその z オーダー順に並べて表示されます。つまり、z オーダーで上位のコントロールほど、コンテナの端から離れた位置に配置されます。
Left、Right、Top、または Bottom が選択された場合、格納されるコントロールの、その指定された端および反対側の端のサイズは、格納する側のコントロールの対応する端のサイズに変更されます。Fillが選択された場合は、格納されるコントロールの四辺のサイズが格納する側のコントロールの四辺のサイズと一致するように変更されます。
GroupBox を作成し、その共通プロパティの一部を設定する例を次に示します。この例では、TextBox を作成し、グループ ボックス内での Location を設定しています。次に、グループ ボックスの Text プロパティを設定して、グループ ボックスをフォームの上部にドッキングします。最後に、Enabled プロパティを false に設定してグループを無効にします。これにより、グループ ボックスに含まれるすべてのコントロールが無効になります。
' Add a GroupBox to a form and set some of its common properties. Private Sub AddMyGroupBox() ' Create a GroupBox and add a TextBox to it. Dim groupBox1 As New GroupBox() Dim textBox1 As New TextBox() textBox1.Location = New Point(15, 15) groupBox1.Controls.Add(textBox1) ' Set the Text and Dock properties of the GroupBox. groupBox1.Text = "MyGroupBox" groupBox1.Dock = DockStyle.Top ' Disable the GroupBox (which disables all its child controls) groupBox1.Enabled = False ' Add the Groupbox to the form. Me.Controls.Add(groupBox1) End Sub
// Add a GroupBox to a form and set some of its common properties. private void AddMyGroupBox() { // Create a GroupBox and add a TextBox to it. GroupBox groupBox1 = new GroupBox(); TextBox textBox1 = new TextBox(); textBox1.Location = new Point(15, 15); groupBox1.Controls.Add(textBox1); // Set the Text and Dock properties of the GroupBox. groupBox1.Text = "MyGroupBox"; groupBox1.Dock = DockStyle.Top; // Disable the GroupBox (which disables all its child controls) groupBox1.Enabled = false; // Add the Groupbox to the form. this.Controls.Add(groupBox1); }
// Add a GroupBox to a form and set some of its common properties. private: void AddMyGroupBox() { // Create a GroupBox and add a TextBox to it. GroupBox^ groupBox1 = gcnew GroupBox; TextBox^ textBox1 = gcnew TextBox; textBox1->Location = Point(15,15); groupBox1->Controls->Add( textBox1 ); // Set the Text and Dock properties of the GroupBox. groupBox1->Text = "MyGroupBox"; groupBox1->Dock = DockStyle::Top; // Disable the GroupBox (which disables all its child controls) groupBox1->Enabled = false; // Add the Groupbox to the form. this->Controls->Add( groupBox1 ); }
// Add a GroupBox to a form and set some of its common properties. private void AddMyGroupBox() { // Create a GroupBox and add a TextBox to it. GroupBox groupBox1 = new GroupBox(); TextBox textBox1 = new TextBox(); textBox1.set_Location(new Point(15, 15)); groupBox1.get_Controls().Add(textBox1); // Set the Text and Dock properties of the GroupBox. groupBox1.set_Text("MyGroupBox"); groupBox1.set_Dock(DockStyle.Top); // Disable the GroupBox (which disables all its child controls) groupBox1.set_Enabled(false); // Add the Groupbox to the form. this.get_Controls().Add(groupBox1); } //AddMyGroupBox
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- DockStyle 列挙体のページへのリンク