2012-04-16 191 views
1

我已经看到comboBoxes看起来像一个小箭头在底部右边的按钮,表明它是一个精灵下拉菜单,有几个选项。这是如何完成的?有什么我可以改变的组合框的属性?谢谢!ComboBox就像一个按钮?

编辑:我使用Windows窗体在Visual Studio 2010

+0

Windows窗体或WPF? – Tigran 2012-04-16 09:31:20

+1

对于WinForms,没有什么开箱即用的。您可以在Infragistics,DevExpress,Telerik和其他人提供的控件套件中找到这种控件。 (例如,Infragistics有一个控件类名称UltraDropDownButton) – Steve 2012-04-16 09:33:46

回答

0

ComboBox.DropDownStyle = ComboBoxStyle.DropDownList试试这个

0
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 
this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; 
this.comboBox1.FormattingEnabled = true; 
this.comboBox1.Items.AddRange(new object[] 
{ 
    "Item 1", 
    "Item 2", 
    "Item 3", 
    "Item 4", 
    "Item 5" 
}); 
+0

谢谢,但这并没有工作 – 2012-04-16 10:01:23

0

我知道OP被问及SplitButton为的WinForms,但WinForms的没有被提及在帖子的标题中,所以寻找分离按钮以供其他技术使用的人可能会在这里结束。

如果您正在寻找WPF中的分割按钮,那么您可以在WPF Extended Toolkit中使用the SplitButton provided free

这是我在WPF应用程序中如何使用它的一个小屏幕截图。

enter image description here