如何在Visual Studio 2008中为简单的Windows窗体应用程序插入下拉菜单?

时间:2022-10-30 09:27:51

There appears to be every other kind of drop-down menu--those that allow user input, those for integers only, those that don't...drop down, and even those that have ugly check boxes next to them. I just want a simple drop-down menu (like you'd see if I used in html) that lets the user choose exactly ONE item. (and one's chosen by default)

似乎还有其他类型的下拉菜单 - 允许用户输入的那些菜单,仅用于整数的菜单,不用于...的用户输入,甚至是那些旁边有丑陋复选框的菜单。我只想要一个简单的下拉菜单(就像你在html中看到的那样),让用户可以选择一个项目。 (默认情况下选择一个)

Any ideas? This should be extremely easy, yet I've spent an hour and half figuring this out...

有任何想法吗?这应该是非常容易的,但我花了一个半小时搞清楚这一点......

2 个解决方案

#1


You can use a ComboBox with its ComboBoxStyle (appears as DropDownStyle in later versions) set to DropDownList. See: http://msdn.microsoft.com/en-us/library/system.windows.forms.comboboxstyle.aspx

您可以将ComboBox与其ComboBoxStyle(在更高版本中显示为DropDownStyle)设置为DropDownList。请参阅:http://msdn.microsoft.com/en-us/library/system.windows.forms.comboboxstyle.aspx

#2


You can use ComboBox, then point your mouse to the upper arrow facing right, it will unfold a box called ComboBox Tasks and in there you can go ahead and edit your items or fill in the items / strings one per line. This should be the easiest.

您可以使用ComboBox,然后将鼠标指向面向右上方的箭头,它将展开一个名为ComboBox Tasks的框,在那里您可以继续编辑您的项目或每行填写一个项目/字符串。这应该是最简单的。

#1


You can use a ComboBox with its ComboBoxStyle (appears as DropDownStyle in later versions) set to DropDownList. See: http://msdn.microsoft.com/en-us/library/system.windows.forms.comboboxstyle.aspx

您可以将ComboBox与其ComboBoxStyle(在更高版本中显示为DropDownStyle)设置为DropDownList。请参阅:http://msdn.microsoft.com/en-us/library/system.windows.forms.comboboxstyle.aspx

#2


You can use ComboBox, then point your mouse to the upper arrow facing right, it will unfold a box called ComboBox Tasks and in there you can go ahead and edit your items or fill in the items / strings one per line. This should be the easiest.

您可以使用ComboBox,然后将鼠标指向面向右上方的箭头,它将展开一个名为ComboBox Tasks的框,在那里您可以继续编辑您的项目或每行填写一个项目/字符串。这应该是最简单的。