DomainUpDown.DomainUpDownItemCollection クラス

定義

DomainUpDown クラスによって使用されるオブジェクトのコレクションをカプセル化します。

public: ref class DomainUpDown::DomainUpDownItemCollection : System::Collections::ArrayList
public class DomainUpDown.DomainUpDownItemCollection : System.Collections.ArrayList
type DomainUpDown.DomainUpDownItemCollection = class
    inherit ArrayList
Public Class DomainUpDown.DomainUpDownItemCollection
Inherits ArrayList
継承
DomainUpDown.DomainUpDownItemCollection

次の例では、コントロールを作成して初期化します DomainUpDown 。 この例では、プロパティの一部を設定し、アップダウン コントロールに表示する文字列のコレクションを作成できます。 このコードでは、 TextBoxフォームで a と CheckBox a Button がインスタンス化されていることを前提としています。 この例では、クラス レベルでメンバー変数が 32 ビット符号付き整数として宣言されていることを前提としています myCounter。 テキスト ボックスに文字列を入力し、ボタンがクリックされたときにコレクションに追加 Items できます。 チェック ボックスをクリックすると、プロパティを Sorted 切り替え、アップダウン コントロール内の項目のコレクションの違いを確認できます。

protected:
   DomainUpDown^ domainUpDown1;

private:
   void InitializeMyDomainUpDown()
   {
      // Create and initialize the DomainUpDown control.
      domainUpDown1 = gcnew DomainUpDown;
      
      // Add the DomainUpDown control to the form.
      Controls->Add( domainUpDown1 );
   }

   void button1_Click( Object^ sender,
      EventArgs^ e )
   {
      // Add the text box contents and initial location in the collection
      // to the DomainUpDown control.
      domainUpDown1->Items->Add( String::Concat(
         (textBox1->Text->Trim()), " - ", myCounter ) );
      
      // Increment the counter variable.
      myCounter = myCounter + 1;
      
      // Clear the TextBox.
      textBox1->Text = "";
   }

   void checkBox1_Click( Object^ sender,
      EventArgs^ e )
   {
      
      // If Sorted is set to true, set it to false; 
      // otherwise set it to true.
      domainUpDown1->Sorted =  !domainUpDown1->Sorted;
   }

   void domainUpDown1_SelectedItemChanged( Object^ sender,
      EventArgs^ e )
   {
      
      // Display the SelectedIndex and 
      // SelectedItem property values in a MessageBox.
      MessageBox::Show( String::Concat( "SelectedIndex: ", domainUpDown1->SelectedIndex,
         "\nSelectedItem: ", domainUpDown1->SelectedItem ) );
   }
protected DomainUpDown domainUpDown1;

private void InitializeMyDomainUpDown()
 {
    // Create and initialize the DomainUpDown control.
    domainUpDown1 = new DomainUpDown();
    
    // Add the DomainUpDown control to the form.
    Controls.Add(domainUpDown1);
 }
 
 private void button1_Click(Object sender, 
                           EventArgs e)
 {   
    // Add the text box contents and initial location in the collection
    // to the DomainUpDown control.
    domainUpDown1.Items.Add((textBox1.Text.Trim()) + " - " + myCounter);
    
    // Increment the counter variable.
    myCounter = myCounter + 1;
 
    // Clear the TextBox.
    textBox1.Text = "";
 }
 
 private void checkBox1_Click(Object sender, 
                             EventArgs e)
 {
    // If Sorted is set to true, set it to false; 
    // otherwise set it to true.
    if (domainUpDown1.Sorted)
    {
       domainUpDown1.Sorted = false;
    }
    else
    {
       domainUpDown1.Sorted = true;
    }
 }
 
 private void domainUpDown1_SelectedItemChanged(Object sender, 
                                               EventArgs e)
 {
    // Display the SelectedIndex and 
    // SelectedItem property values in a MessageBox.
    MessageBox.Show("SelectedIndex: " + domainUpDown1.SelectedIndex.ToString() 
       + "\n" + "SelectedItem: " + domainUpDown1.SelectedItem.ToString());
 }
Protected domainUpDown1 As DomainUpDown


Private Sub InitializeMyDomainUpDown()
    ' Create and initialize the DomainUpDown control.
    domainUpDown1 = New DomainUpDown()
    
    ' Add the DomainUpDown control to the form.
    Controls.Add(domainUpDown1)
End Sub


Private Sub button1_Click(sender As Object, e As EventArgs)
    ' Add the text box contents and initial location in the collection
    ' to the DomainUpDown control.
    domainUpDown1.Items.Add((textBox1.Text.Trim() & " - " & myCounter))
    
    ' Increment the counter variable.
    myCounter = myCounter + 1
    
    ' Clear the TextBox.
    textBox1.Text = ""
End Sub


Private Sub checkBox1_Click(sender As Object, e As EventArgs)
    ' If Sorted is set to true, set it to false; 
    ' otherwise set it to true.
    If domainUpDown1.Sorted Then
        domainUpDown1.Sorted = False
    Else
        domainUpDown1.Sorted = True
    End If
End Sub


Private Sub domainUpDown1_SelectedItemChanged _
    (sender As Object, e As EventArgs)
    
    ' Display the SelectedIndex and 
    ' SelectedItem property values in a MessageBox.
    MessageBox.Show(("SelectedIndex: " & domainUpDown1.SelectedIndex.ToString() & _
        ControlChars.Cr & "SelectedItem: " & domainUpDown1.SelectedItem.ToString()))
End Sub

注釈

コントロールに表示DomainUpDownするオブジェクトのコレクションを作成するには、and メソッドを使用してAddRemove項目を個別に追加または削除します。 コレクションは、プロパティによってItems親コントロールDomainUpDownからアクセスされます。

プロパティ

Capacity

ArrayList に格納できる要素の数を取得または設定します。

(継承元 ArrayList)
Count

ArrayList に実際に含まれる要素の数を取得します。

(継承元 ArrayList)
IsFixedSize

ArrayList が固定サイズかどうかを示す値を取得します。

(継承元 ArrayList)
IsReadOnly

ArrayList が読み取り専用かどうかを示す値を取得します。

(継承元 ArrayList)
IsSynchronized

ArrayList へのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。

(継承元 ArrayList)
Item[Int32]

コレクション内の指定したインデックス位置にある項目を取得または設定します。

SyncRoot

ArrayList へのアクセスを同期するために使用できるオブジェクトを取得します。

(継承元 ArrayList)

メソッド

Add(Object)

指定したオブジェクトをコレクションの末尾に追加します。

AddRange(ICollection)

ICollection の要素を ArrayList の末尾に追加します。

(継承元 ArrayList)
BinarySearch(Int32, Int32, Object, IComparer)

指定した比較子を使用して、並べ替えられた要素の ArrayList の 1 つの要素の範囲を検索し、その要素の 0 から始まるインデックスを返します。

(継承元 ArrayList)
BinarySearch(Object)

既定の比較子を使用して、並べ替えられた要素の ArrayList 全体を検索し、その要素の 0 から始まるインデックスを返します。

(継承元 ArrayList)
BinarySearch(Object, IComparer)

指定した比較子を使用して、並べ替えられた要素の ArrayList 全体を検索し、その要素の 0 から始まるインデックスを返します。

(継承元 ArrayList)
Clear()

ArrayList からすべての要素を削除します。

(継承元 ArrayList)
Clone()

ArrayList の簡易コピーを作成します。

(継承元 ArrayList)
Contains(Object)

ある要素が ArrayList 内に存在するかどうかを判断します。

(継承元 ArrayList)
CopyTo(Array)

ArrayList 全体を互換性のある 1 次元の Array にコピーします。コピー操作は、コピー先の配列の先頭から始まります。

(継承元 ArrayList)
CopyTo(Array, Int32)

ArrayList 全体を互換性のある 1 次元の Array にコピーします。コピー操作は、コピー先の配列の指定したインデックスから始まります。

(継承元 ArrayList)
CopyTo(Int32, Array, Int32, Int32)

要素の範囲を ArrayList から互換性のある 1 次元の Array にコピーします。コピー操作は、コピー先の配列の指定したインデックスから始まります。

(継承元 ArrayList)
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetEnumerator()

全体の ArrayList の列挙子を返します。

(継承元 ArrayList)
GetEnumerator(Int32, Int32)

ArrayList 内の要素の範囲の列挙子を返します。

(継承元 ArrayList)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetRange(Int32, Int32)

元の ArrayList 内の要素のサブセットを表す ArrayList を返します。

(継承元 ArrayList)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IndexOf(Object)

指定した Object を検索し、ArrayList 全体内で最初に見つかった位置の 0 から始まるインデックスを返します。

(継承元 ArrayList)
IndexOf(Object, Int32)

指定した Object を検索し、指定したインデックスから最後の要素までの ArrayList 内の要素の範囲内で最初に出現する位置の 0 から始まるインデックス番号を返します。

(継承元 ArrayList)
IndexOf(Object, Int32, Int32)

指定した Object を検索し、指定したインデックスから始まって指定した数の要素を格納する ArrayList 内の要素の範囲内で最初に出現する位置の 0 から始まるインデックス番号を返します。

(継承元 ArrayList)
Insert(Int32, Object)

指定したオブジェクトをコレクション内の指定した位置に挿入します。

InsertRange(Int32, ICollection)

コレクションの要素を ArrayList 内の指定したインデックスの位置に挿入します。

(継承元 ArrayList)
LastIndexOf(Object)

指定した Object を検索し、ArrayList 全体で最後に見つかった位置の 0 から始まるインデックスを返します。

(継承元 ArrayList)
LastIndexOf(Object, Int32)

指定した Object を検索し、最初の要素から、指定したインデックスまでの ArrayList 内の要素の範囲内で最後に出現する位置の 0 から始まるインデックス番号を返します。

(継承元 ArrayList)
LastIndexOf(Object, Int32, Int32)

指定した Object を検索し、指定した数の要素を含み、かつ指定したインデックスで終了する ArrayList 内の要素の範囲内で最後に出現する位置の 0 から始まるインデックス番号を返します。

(継承元 ArrayList)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
Remove(Object)

指定した項目をコレクションから削除します。

RemoveAt(Int32)

項目をコレクションの指定した位置から削除します。

RemoveRange(Int32, Int32)

ArrayList から要素の範囲を削除します。

(継承元 ArrayList)
Reverse()

ArrayList 全体の要素の順序を反転させます。

(継承元 ArrayList)
Reverse(Int32, Int32)

指定した範囲の要素の順序を反転させます。

(継承元 ArrayList)
SetRange(Int32, ICollection)

コレクションの要素を ArrayList 内の要素の範囲にコピーします。

(継承元 ArrayList)
Sort()

ArrayList 全体で要素を並べ替えます。

(継承元 ArrayList)
Sort(IComparer)

指定した比較子を使用して、ArrayList 全体内の要素を並べ替えます。

(継承元 ArrayList)
Sort(Int32, Int32, IComparer)

指定した比較子を使用して、ArrayList 内の要素の範囲内の要素を並べ替えます。

(継承元 ArrayList)
ToArray()

ArrayList の要素を新しい Object 配列にコピーします。

(継承元 ArrayList)
ToArray(Type)

ArrayList の要素を、指定した要素型の新しい配列にコピーします。

(継承元 ArrayList)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
TrimToSize()

容量を ArrayList 内にある実際の要素数に設定します。

(継承元 ArrayList)

拡張メソッド

Cast<TResult>(IEnumerable)

IEnumerable の要素を、指定した型にキャストします。

OfType<TResult>(IEnumerable)

指定された型に基づいて IEnumerable の要素をフィルター処理します。

AsParallel(IEnumerable)

クエリの並列化を有効にします。

AsQueryable(IEnumerable)

IEnumerableIQueryable に変換します。

適用対象

こちらもご覧ください