Form.ControlCollectionとは? わかりやすく解説

Form.ControlCollection クラス

フォーム上のコントロールのコレクションを表します。

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

<ComVisibleAttribute(False)> _
Public Class ControlCollection
    Inherits ControlCollection
Dim instance As ControlCollection
[ComVisibleAttribute(false)] 
public class ControlCollection : ControlCollection
[ComVisibleAttribute(false)] 
public ref class ControlCollection : public
 ControlCollection
/** @attribute ComVisibleAttribute(false) */ 
public class ControlCollection extends ControlCollection
ComVisibleAttribute(false) 
public class ControlCollection extends
 ControlCollection
解説解説
使用例使用例

TextBox コントロールと Label コントロールをフォームのコントロール コレクションに追加するコード例を次に示します。この例では、フォームが Form1 という名前で作成されている必要があります。

Public Sub AddMyControls()
    Dim textBox1 As New
 TextBox()
    Dim label1 As New Label()
    
    ' Initialize the controls and their bounds.
    label1.Text = "First Name"
    label1.Location = New Point(48, 48)
    label1.Size = New Size(104, 16)
    textBox1.Text = ""
    textBox1.Location = New Point(48, 64)
    textBox1.Size = New Size(104, 16)
    
    ' Add the TextBox control to the form's control collection.
    Controls.Add(textBox1)
    ' Add the Label control to the form's control collection.
    Controls.Add(label1)
End Sub 'AddMyControls
public void AddMyControls()
 {
    TextBox textBox1 = new TextBox();
    Label label1 = new Label();
    
    // Initialize the controls and their bounds.
    label1.Text = "First Name";
    label1.Location = new Point(48,48);
    label1.Size = new Size (104, 16);
    textBox1.Text = "";
    textBox1.Location = new Point(48, 64);
    textBox1.Size = new Size(104,16);
 
    // Add the TextBox control to the form's control collection.
    Controls.Add(textBox1);
    // Add the Label control to the form's control collection.
    Controls.Add(label1);
 }
 
public:
   void AddMyControls()
   {
      TextBox^ textBox1 = gcnew TextBox;
      Label^ label1 = gcnew Label;
      
      // Initialize the controls and their bounds.
      label1->Text = "First Name";
      label1->Location = Point( 48, 48 );
      label1->Size = System::Drawing::Size( 104, 16 );
      textBox1->Text = "";
      textBox1->Location = Point(48,64);
      textBox1->Size = System::Drawing::Size( 104, 16 );
      
      // Add the TextBox control to the form's control collection.
      Controls->Add( textBox1 );
      // Add the Label control to the form's control collection.
      Controls->Add( label1 );
   }
継承階層継承階層
System.Object
   System.Windows.Forms.Layout.ArrangedElementCollection
     System.Windows.Forms.Control.ControlCollection
      System.Windows.Forms.Form.ControlCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Form.ControlCollection メンバ
System.Windows.Forms 名前空間
Control.ControlCollection クラス

Form.ControlCollection コンストラクタ

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

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

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Form.ControlCollection クラス
Form.ControlCollection メンバ
System.Windows.Forms 名前空間

Form.ControlCollection プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Count  コレクション内の要素の数を取得します。 ( ArrangedElementCollection から継承されます。)
パブリック プロパティ IsReadOnly  コレクションが読み取り専用かどうかを示す値を取得します。 ( ArrangedElementCollection から継承されます。)
パブリック プロパティ Item  オーバーロードされます。 コレクション内の Control を示します。 ( Control.ControlCollection から継承されます。)
パブリック プロパティ Owner  この Control.ControlCollection を所有しているコントロールを取得します。 ( Control.ControlCollection から継承されます。)
参照参照

関連項目

Form.ControlCollection クラス
System.Windows.Forms 名前空間
Control.ControlCollection クラス

Form.ControlCollection メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Add オーバーライドされます。 コントロールをフォームに追加します。
パブリック メソッド AddRange  コレクションにコントロール オブジェクトの配列を追加します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド Clear  コレクションからすべてのコントロールを削除します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド Contains  指定したコントロールがコレクションのメンバかどうかを確認します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド ContainsKey  指定したキーを持つ項目が Control.ControlCollection に含まれているかどうかを確認します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド CopyTo  コピー先配列の指定されたインデックスを開始位置として、このコレクションの内容全体を互換性がある 1 次元 Array にコピーします。 ( ArrangedElementCollection から継承されます。)
パブリック メソッド Equals  オーバーロードされます。 2 つの ArrangedElementCollection インスタンスが等しいかどうかを判断します。 ( ArrangedElementCollection から継承されます。)
パブリック メソッド Find  コントロールの Name プロパティに基づいてコントロールを検索し、一致するすべてのコントロールの配列を構築します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド GetChildIndex  オーバーロードされます。 コントロール コレクション内のコントロールのインデックスを取得します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド GetEnumerator  Control.ControlCollection の反復処理に使用する列挙体オブジェクトへの参照を取得します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 ( ArrangedElementCollection から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド IndexOf  コントロール コレクション内の指定したコントロールのインデックスを取得します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド IndexOfKey  指定した項目がこのコレクション内で最初に見つかった位置のインデックスを取得します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド Remove オーバーライドされます。 フォームからコントロールを削除します。
パブリック メソッド RemoveAt  指定したインデックス位置にあるコントロール コレクションからコントロールを削除します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド RemoveByKey  指定したキーを持つ子コントロールを削除します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド SetChildIndex  コレクション内の指定した子コントロールのインデックスを指定したインデックス値に設定します。 ( Control.ControlCollection から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

Form.ControlCollection クラス
System.Windows.Forms 名前空間
Control.ControlCollection クラス

Form.ControlCollection メンバ

フォーム上のコントロールのコレクションを表します。

Form.ControlCollection データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド Form.ControlCollection Form.ControlCollection クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Count  コレクション内の要素の数を取得します。(ArrangedElementCollection から継承されます。)
パブリック プロパティ IsReadOnly  コレクションが読み取り専用かどうかを示す値を取得します。(ArrangedElementCollection から継承されます。)
パブリック プロパティ Item  オーバーロードされます。 コレクション内の Control を示します。(Control.ControlCollection から継承されます。)
パブリック プロパティ Owner  この Control.ControlCollection を所有しているコントロールを取得します。(Control.ControlCollection から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド Add オーバーライドされます。 コントロールをフォームに追加します。
パブリック メソッド AddRange  コレクションにコントロール オブジェクトの配列を追加します。 (Control.ControlCollection から継承されます。)
パブリック メソッド Clear  コレクションからすべてのコントロールを削除します。 (Control.ControlCollection から継承されます。)
パブリック メソッド Contains  指定したコントロールがコレクションのメンバかどうかを確認します。 (Control.ControlCollection から継承されます。)
パブリック メソッド ContainsKey  指定したキーを持つ項目が Control.ControlCollection に含まれているかどうかを確認します。 (Control.ControlCollection から継承されます。)
パブリック メソッド CopyTo  コピー先配列の指定されたインデックスを開始位置として、このコレクションの内容全体を互換性がある 1 次元 Array にコピーします。 (ArrangedElementCollection から継承されます。)
パブリック メソッド Equals  オーバーロードされます。 2 つの ArrangedElementCollection インスタンスが等しいかどうかを判断します。 (ArrangedElementCollection から継承されます。)
パブリック メソッド Find  コントロールの Name プロパティに基づいてコントロールを検索し、一致するすべてのコントロールの配列を構築します。 (Control.ControlCollection から継承されます。)
パブリック メソッド GetChildIndex  オーバーロードされます。 コントロール コレクション内のコントロールのインデックスを取得します。 (Control.ControlCollection から継承されます。)
パブリック メソッド GetEnumerator  Control.ControlCollection の反復処理に使用する列挙体オブジェクトへの参照を取得します。 (Control.ControlCollection から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 (ArrangedElementCollection から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IndexOf  コントロール コレクション内の指定したコントロールのインデックスを取得します。 (Control.ControlCollection から継承されます。)
パブリック メソッド IndexOfKey  指定した項目がこのコレクション内で最初に見つかった位置のインデックスを取得します。 (Control.ControlCollection から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド Remove オーバーライドされます。 フォームからコントロールを削除します。
パブリック メソッド RemoveAt  指定したインデックス位置にあるコントロール コレクションからコントロールを削除します。 (Control.ControlCollection から継承されます。)
パブリック メソッド RemoveByKey  指定したキーを持つ子コントロールを削除します。 (Control.ControlCollection から継承されます。)
パブリック メソッド SetChildIndex  コレクション内の指定した子コントロールのインデックスを指定したインデックス値に設定します。 (Control.ControlCollection から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

Form.ControlCollection クラス
System.Windows.Forms 名前空間
Control.ControlCollection クラス



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「Form.ControlCollection」の関連用語

Form.ControlCollectionのお隣キーワード
検索ランキング

   

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



Form.ControlCollectionのページの著作権

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

©2026 GRAS Group, Inc.RSS