다음을 통해 공유


DomainUpDown.DomainUpDownItemCollection 클래스

이 클래스는 .NET Framework 인프라를 지원하며 코드에서 직접 사용할 수 없습니다.

DomainUpDown 클래스에서 사용할 개체의 컬렉션을 캡슐화합니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Class DomainUpDownItemCollection
    Inherits ArrayList
‘사용 방법
Dim instance As DomainUpDownItemCollection
public class DomainUpDownItemCollection : ArrayList
public ref class DomainUpDownItemCollection : public ArrayList
public class DomainUpDownItemCollection extends ArrayList
public class DomainUpDownItemCollection extends ArrayList

설명

DomainUpDown 컨트롤에 표시할 개체 컬렉션을 만들려면 AddRemove 메서드를 사용하여 항목을 개별적으로 추가하거나 제거하면 됩니다. 컨트롤은 부모 컨트롤 DomainUpDown에서 Items 속성에 의해 액세스됩니다.

예제

다음 예제에서는 DomainUpDown 컨트롤을 만든 후 초기화합니다. 이 예제에서 해당 속성 중 일부를 설정하고 UpDown 컨트롤에 표시할 문자열 컬렉션을 만들 수 있습니다. 이 코드는 TextBox, CheckBoxButton이 폼에 인스턴스화되었다고 가정합니다. 또한 이 예제에서는 사용자가 myCounter라는 32비트 부호 있는 정수로 선언된 클래스 수준에서 멤버 변수를 가지고 있다고 가정합니다. 입력란에 문자열을 입력한 다음 해당 단추를 클릭하여 Items 컬렉션에 추가할 수 있습니다. 확인란을 클릭하면 Sorted 속성을 설정하거나 해제하고 UpDown 컨트롤에 있는 항목 컬렉션에서 차이점을 관찰할 수 있습니다.

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 'InitializeMyDomainUpDown


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 'button1_Click


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 'checkBox1_Click


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 'domainUpDown1_SelectedItemChanged
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:
   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 ) );
   }

상속 계층 구조

System.Object
   System.Collections.ArrayList
    System.Windows.Forms.DomainUpDown.DomainUpDownItemCollection

스레드로부터의 안전성

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

DomainUpDown.DomainUpDownItemCollection 멤버
System.Windows.Forms 네임스페이스
DomainUpDown.Items 속성