Control.Locationとは? わかりやすく解説

Control.Location プロパティ

コンテナ左上隅に対す相対座標として、コントロール左上隅の座標取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

解説解説
使用例使用例

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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ControlLocation 列挙体

メモ : この列挙体は、.NET Framework version 2.0新しく追加されたものです。

コントロール追加するコンテナ内の位置指定します

名前空間: System.Web.UI.Design
アセンブリ: System.Design (system.design.dll 内)
構文構文

Dim instance As ControlLocation
public enum ControlLocation
public enum class ControlLocation
public enum ControlLocation
public enum ControlLocation
メンバメンバ
解説解説

ControlLocation 列挙体は WebFormsRootDesigner.AddControlToDocument メソッドによって使用されます。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からControl.Locationを検索した結果を表示しています。
Weblioに収録されているすべての辞書からControl.Locationを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からControl.Location を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Control.Location」の関連用語

Control.Locationのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Control.Locationのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS