ToolStripComboBox.DropDownStyle 屬性

定義

取得或設定指定 ToolStripComboBox 樣式的值。Gets or sets a value specifying the style of the 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 值。One of the ComboBoxStyle values. 預設為 DropDownThe default is DropDown.

範例

下列程式碼範例示範設定各種 ToolStripComboBox 屬性的語法,包括 DropDownStyle 屬性。The following code example demonstrates the syntax for setting various ToolStripComboBox properties, including the DropDownStyle property.

// 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 屬性可控制向使用者呈現的介面。The DropDownStyle property controls the interface that is presented to the user. 您可以輸入一個值,允許簡單的下拉式清單方塊,其中的清單一律會顯示為下拉式清單方塊,其中的文字部分無法編輯,而且您必須選取箭號來查看下拉式清單或預設下拉式清單方塊(其中文字部分為 ed)itable 和使用者必須按方向鍵來查看清單。You can enter a value that allows for a simple drop-down list box, where the list always displays, a drop-down list box, where the text portion is not editable and you must select an arrow to view the drop-down, or the default drop-down list box, where the text portion is editable and the user must press the arrow key to view the list. 若要一律顯示使用者無法編輯的清單,請使用 ListBox 控制項。To always display a list that the user cannot edit, use a ListBox control.

適用於