ComboBoxStyle 列挙型

定義

ComboBox のスタイルを指定します。

public enum class ComboBoxStyle
public enum ComboBoxStyle
type ComboBoxStyle = 
Public Enum ComboBoxStyle
継承
ComboBoxStyle

フィールド

DropDown 1

下向きの矢印をクリックすると一覧が表示されること、およびテキスト部分が編集可能であることを指定します。 つまり、ユーザーは一覧で既存の値を選択できるだけでなく、新しい値を入力することもできます。 この設定を使用する場合、AppendAutoCompleteMode 値は SuggestAppend 値と同じ動作になります。 これは、既定のスタイルです。

DropDownList 2

下向きの矢印をクリックすると一覧が表示されること、およびテキスト部分が編集可能でないことを指定します。 つまり、ユーザーが新しい値を入力することはできません。 選択できるのは、一覧に既に含まれている値だけです。 AutoCompleteMode については、Suggest または SuggestAppend の場合にのみ一覧が表示されます。

Simple 0

常に一覧が表示されること、およびテキスト部分が編集可能であることを指定します。 つまり、ユーザーは一覧で既存の値を選択できるだけでなく、新しい値を入力することもできます。

次のコード例では、 プロパティを値に設定してコントロールをComboBox.DropDownStyle初期化ComboBoxする方法をComboBoxStyle示します。

   // 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->IntegralHeight = false;
      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.
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.IntegralHeight = false;
    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.
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.IntegralHeight = False
    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

注釈

プロパティは DropDownStyle 、リストを常に表示するか、リストをドロップダウンに表示するかを指定します。 プロパティは DropDownStyle 、テキスト部分を編集できるかどうかを指定します。

適用対象