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#.
LarsTech
Set the ListBox's property IntegralHeight = false;
so that it won't resize the control by the item height variable.
Set the IntegralHeight property of the listbox to false
来源:https://stackoverflow.com/questions/10517926/listbox-autosizes-by-item-height