Share via


ToolStripComboBox.DropDownStyle 屬性

定義

取得或設定指定 ToolStripComboBox 樣式的值。

public:
 property System::Windows::Forms::ComboBoxStyle DropDownStyle { System::Windows::Forms::ComboBoxStyle get(); void set(System::Windows::Forms::ComboBoxStyle value); };
public System.Windows.Forms.ComboBoxStyle DropDownStyle { get; set; }
member this.DropDownStyle : System.Windows.Forms.ComboBoxStyle with get, set
Public Property DropDownStyle As ComboBoxStyle

屬性值

ComboBoxStyle

其中一個 ComboBoxStyle 值。 預設為 DropDown

範例

下列程式碼範例示範設定各種 ToolStripComboBox 屬性的語法,包括 DropDownStyle 屬性。

// The following code example demonstrates the syntax for setting
// various ToolStripComboBox properties.
// 
toolStripComboBox1.AutoCompleteCustomSource.AddRange(new string[] {
"aaa",
"bbb",
"ccc"});
toolStripComboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
toolStripComboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
toolStripComboBox1.DropDownHeight = 110;
toolStripComboBox1.DropDownWidth = 122;
toolStripComboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Standard;
toolStripComboBox1.IntegralHeight = false;
toolStripComboBox1.Items.AddRange(new object[] {
"xxx",
"yyy",
"zzz"});
toolStripComboBox1.MaxDropDownItems = 9;
toolStripComboBox1.MergeAction = System.Windows.Forms.MergeAction.Insert;
toolStripComboBox1.Name = "toolStripComboBox1";
toolStripComboBox1.Size = new System.Drawing.Size(121, 25);
toolStripComboBox1.Sorted = true;
' The following code example demonstrates the syntax for setting
' various ToolStripComboBox properties.
' 
toolStripComboBox1.AutoCompleteCustomSource.AddRange(New String() {"aaa", "bbb", "ccc"})
toolStripComboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend
toolStripComboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource
toolStripComboBox1.DropDownHeight = 110
toolStripComboBox1.DropDownWidth = 122
toolStripComboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Standard
toolStripComboBox1.IntegralHeight = False
toolStripComboBox1.Items.AddRange(New Object() {"xxx", "yyy", "zzz"})
toolStripComboBox1.MaxDropDownItems = 9
toolStripComboBox1.MergeAction = System.Windows.Forms.MergeAction.Insert
toolStripComboBox1.Name = "toolStripComboBox1"
toolStripComboBox1.Size = New System.Drawing.Size(121, 25)
toolStripComboBox1.Sorted = True

備註

屬性 DropDownStyle 會控制向使用者呈現的介面。 您可以輸入允許簡單下拉式清單方塊的值,其中清單一律會顯示、下拉式清單方塊、無法編輯文字部分,而且您必須選取箭號來檢視下拉式清單方塊,或預設的下拉式清單方塊,其中文字部分是可編輯的,而且使用者必須按下方向鍵才能檢視清單。 若要一律顯示使用者無法編輯的清單,請使用 ListBox 控制項。

適用於