Freigeben über


ComboBoxStyle-Enumeration

Gibt das ComboBox-Format an.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Enumeration ComboBoxStyle
'Usage
Dim instance As ComboBoxStyle
public enum ComboBoxStyle
public enum class ComboBoxStyle
public enum ComboBoxStyle
public enum ComboBoxStyle

Member

  Membername Beschreibung
Unterstützt von .NET Compact Framework DropDown Der Textbereich ist editierbar. Der Benutzer muss auf die Pfeilschaltfläche klicken, um den Listenbereich anzuzeigen. Dies ist das Standardformat. 
Unterstützt von .NET Compact Framework DropDownList Der Benutzer kann den Textbereich nicht direkt bearbeiten. Der Benutzer muss auf die Pfeilschaltfläche klicken, um den Listenbereich anzuzeigen. Die Liste wird nur angezeigt, wenn AutoCompleteModeSuggest oder SuggestAppend ist. 
Simple Der Textbereich ist editierbar. Der Listenbereich ist immer sichtbar. 

Hinweise

Die DropDownStyle-Eigenschaft bestimmt, ob der Benutzer einen neuen Wert in den Textbereich eingeben kann und ob der Listenbereich immer angezeigt wird.

Hinweis zu Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows CE: Die Standardart ist DropDownList.

Beispiel

Im folgenden Beispielcode wird die Initialisierung eines ComboBox-Steuerelements durch Festlegen der ComboBox.DropDownStyle-Eigenschaft auf einen ComboBoxStyle-Wert festgelegt.

' Declare comboBox1 as a ComboBox.
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox

' This method initializes the combo box, adding a large string 
' array but limiting the drop-down size to six rows so the combo box
' doesn't cover other controls when it expands.
Private Sub InitializeComboBox()
    Me.ComboBox1 = New System.Windows.Forms.ComboBox
    Dim employees() As String = New String() {"Hamilton, David", _
        "Hensien, Kari", "Hammond, Maria", "Harris, Keith", _
        "Henshaw, Jeff D.", "Hanson, Mark", "Harnpadoungsataya, Sariya", _
        "Harrington, Mark", "Harris, Keith", "Hartwig, Doris", _
        "Harui, Roger", "Hassall, Mark", "Hasselberg, Jonas", _
        "Harnpadoungsataya, Sariya", "Henshaw, Jeff D.", "Henshaw, Jeff D.", _
        "Hensien, Kari", "Harris, Keith", "Henshaw, Jeff D.", _
        "Hensien, Kari", "Hasselberg, Jonas", "Harrington, Mark", _
        "Hedlund, Magnus", "Hay, Jeff", "Heidepriem, Brandon D."}

    ComboBox1.Items.AddRange(employees)
    Me.ComboBox1.Location = New System.Drawing.Point(136, 32)
    Me.ComboBox1.MaxDropDownItems = 5
    Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDown
    Me.ComboBox1.Name = "ComboBox1"
    Me.ComboBox1.Size = New System.Drawing.Size(136, 81)
    Me.ComboBox1.TabIndex = 0
    Me.Controls.Add(Me.ComboBox1)
End Sub

// Declare comboBox1 as a ComboBox.
internal System.Windows.Forms.ComboBox ComboBox1;

// This method initializes the combo box, adding a large string array
// but limiting the drop-down size to six rows so the combo box doesn't 
// cover other controls when it expands.
private void InitializeComboBox()
{
    this.ComboBox1 = new System.Windows.Forms.ComboBox();
    string[] employees = new string[]{"Hamilton, David", "Hensien, Kari",
            "Hammond, Maria", "Harris, Keith", "Henshaw, Jeff D.", 
            "Hanson, Mark", "Harnpadoungsataya, Sariya", 
            "Harrington, Mark", "Harris, Keith", "Hartwig, Doris", 
            "Harui, Roger", "Hassall, Mark", "Hasselberg, Jonas", 
            "Harnpadoungsataya, Sariya", "Henshaw, Jeff D.", 
            "Henshaw, Jeff D.", "Hensien, Kari", "Harris, Keith", 
            "Henshaw, Jeff D.", "Hensien, Kari", "Hasselberg, Jonas",
            "Harrington, Mark", "Hedlund, Magnus", "Hay, Jeff", 
            "Heidepriem, Brandon D."};

    ComboBox1.Items.AddRange(employees);
    this.ComboBox1.Location = new System.Drawing.Point(136, 32);
    this.ComboBox1.MaxDropDownItems = 5;
    this.ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
    this.ComboBox1.Name = "ComboBox1";
    this.ComboBox1.Size = new System.Drawing.Size(136, 81);
    this.ComboBox1.TabIndex = 0;
    this.Controls.Add(this.ComboBox1);
    
    // Associate the event-handling method with the 
    // SelectedIndexChanged event.
    this.ComboBox1.SelectedIndexChanged += 
        new System.EventHandler(ComboBox1_SelectedIndexChanged);
}
   // Declare comboBox1 as a ComboBox.
internal:
   System::Windows::Forms::ComboBox^ ComboBox1;

private:
   // This method initializes the combo box, adding a large string array
   // but limiting the drop-down size to six rows so the combo box doesn't 
   // cover other controls when it expands.
   void InitializeComboBox()
   {
      this->ComboBox1 = gcnew System::Windows::Forms::ComboBox;
      array<String^>^ employees = {"Hamilton, David","Hensien, Kari",
         "Hammond, Maria","Harris, Keith","Henshaw, Jeff D.",
         "Hanson, Mark","Harnpadoungsataya, Sariya",
         "Harrington, Mark","Harris, Keith","Hartwig, Doris",
         "Harui, Roger","Hassall, Mark","Hasselberg, Jonas",
         "Harnpadoungsataya, Sariya","Henshaw, Jeff D.",
         "Henshaw, Jeff D.","Hensien, Kari","Harris, Keith",
         "Henshaw, Jeff D.","Hensien, Kari","Hasselberg, Jonas",
         "Harrington, Mark","Hedlund, Magnus","Hay, Jeff",
         "Heidepriem, Brandon D."};
      ComboBox1->Items->AddRange( employees );
      this->ComboBox1->Location = System::Drawing::Point( 136, 32 );
      this->ComboBox1->MaxDropDownItems = 5;
      this->ComboBox1->DropDownStyle = ComboBoxStyle::DropDownList;
      this->ComboBox1->Name = "ComboBox1";
      this->ComboBox1->Size = System::Drawing::Size( 136, 81 );
      this->ComboBox1->TabIndex = 0;
      this->Controls->Add( this->ComboBox1 );
      
      // Associate the event-handling method with the 
      // SelectedIndexChanged event.
      this->ComboBox1->SelectedIndexChanged +=
         gcnew System::EventHandler( this, &Form1::ComboBox1_SelectedIndexChanged );
   }
// Declare comboBox1 as a ComboBox.
System.Windows.Forms.ComboBox comboBox1;

// This method initializes the combo box, adding a large string array
// but limiting the drop-down size to six rows so the combo box doesn't 
// cover other controls when it expands.
private void InitializeComboBox()
{
    this.comboBox1 = new System.Windows.Forms.ComboBox();
    String employees[] = new String[] { "Hamilton, David", "Hensien, Kari", 
        "Hammond, Maria", "Harris, Keith", "Henshaw, Jeff D.", 
        "Hanson, Mark", "Harnpadoungsataya, Sariya", "Harrington, Mark",
        "Harris, Keith", "Hartwig, Doris", "Harui, Roger", "Hassall, Mark",
        "Hasselberg, Jonas", "Harnpadoungsataya, Sariya", 
        "Henshaw, Jeff D.","Henshaw, Jeff D.", "Hensien, Kari", 
        "Harris, Keith", "Henshaw, Jeff D.", "Hensien, Kari", 
        "Hasselberg, Jonas", "Harrington, Mark", "Hedlund, Magnus", 
        "Hay, Jeff", "Heidepriem, Brandon D." };

    comboBox1.get_Items().AddRange(employees);
    this.comboBox1.set_Location(new System.Drawing.Point(136, 32));
    this.comboBox1.set_MaxDropDownItems(5);
    this.comboBox1.set_DropDownStyle(ComboBoxStyle.DropDownList);
    this.comboBox1.set_Name("comboBox1");
    this.comboBox1.set_Size(new System.Drawing.Size(136, 81));
    this.comboBox1.set_TabIndex(0);
    this.get_Controls().Add(this.comboBox1);
    // Associate the event-handling method with the 
    // SelectedIndexChanged event.
    this.comboBox1.add_SelectedIndexChanged(new System.EventHandler(
        comboBox1_SelectedIndexChanged));
} //InitializeComboBox

Plattformen

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

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

System.Windows.Forms-Namespace