简体   繁体   English

组合框显示所有项目

[英]Combobox show all items

I have a ComboBox in "DropDownList" mode filled with 12 items in VB.NET program. 我在“ DropDownList”模式下有一个ComboBox,在VB.NET程序中填充了12个项目。

When I click to it on my machine with windows 7 all 12 items are showed. 当我在装有Windows 7的计算机上单击它时,将显示所有12个项目。 Same is in machine with windows 8. Windows 8的机器也是如此。

But same ComboBox on machine with windows XP shows only 8 items in dropdown list and it is needed to scroll to come to last item. 但是使用Windows XP的计算机上的同一ComboBox在下拉列表中仅显示8个项目,需要滚动到最后一个项目。

Is it possible to get that all 12 items will be showed in ComboBox's dropdown list in windows XP system as well and how to get that? 是否有可能将所有12个项目也显示在Windows XP系统的ComboBox的下拉列表中,以及如何获取?

You can modify the DropDownHeight property of the ComboBox, but you will have to work out the height of each item to know how big to set this because the value is in pixels and users who have large fonts will have a larger pixel height for each item like this: 您可以修改ComboBox的DropDownHeight属性,但必须计算出每个项目的高度,才能知道将其设置为多少,因为该值以像素为单位,使用大字体的用户将为每个项目设置更大的像素高度像这样:

ComboBox1.DropDownHeight = ComboBox1.ItemHeight * 12

Documentation: 文档:

DropDownHeight : DropDownHeight

http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.dropdownheight(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.dropdownheight(v=vs.110).aspx

ItemHeight : ItemHeight

http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.itemheight(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.itemheight(v=vs.110).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM