ListBox AutoSizes by item height

喜欢而已 提交于 2019-12-19 19:12:26

问题


I use TableLayoutPanel for all my elements in a form. I use Dock Fill to autosize a TextBox and a ListBox. TextBox fits perfectly in a cell of the TableLayoutPanel but not a ListBox. It autosizes by item height.

How to delete this gap between the bottom of the ListBox and the bottom of the form? I know I can set the height of the ListBox by a certain value (e.g. item height in the ListBox is 16, 16 * 10 elements= 160, 160 will fit correctly), but is there any other solutions?
I'm using C#.


回答1:


Set the ListBox's property IntegralHeight = false; so that it won't resize the control by the item height variable.




回答2:


Set the IntegralHeight property of the listbox to false



来源:https://stackoverflow.com/questions/10517926/listbox-autosizes-by-item-height

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!