ToolStripComboBox.Sorted 屬性

定義

取得或設定值,指出 ToolStripComboBox 中的項目是否會排序。

public:
 property bool Sorted { bool get(); void set(bool value); };
public bool Sorted { get; set; }
member this.Sorted : bool with get, set
Public Property Sorted As Boolean

屬性值

如果下拉式方塊已排序,則為 true,否則為 false。 預設為 false

範例

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

// 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

備註

這個屬性會指定 是否 ToolStripComboBox 排序現有的專案,並將新專案新增至清單中的適當排序位置。 您可以使用這個屬性自動排序 中的 ToolStripComboBox 專案。 當專案新增至已 ToolStripComboBox 排序的 時,專案會移至排序清單中的適當位置。 當您將 屬性設定為 false 時,新專案會新增至現有清單的結尾。 排序不區分大小寫,並以字母順序遞增。

適用於