6

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.

enter image description here

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
  • 80,625
  • 14
  • 153
  • 225
Mo3r
  • 112
  • 1
  • 2
  • 6

2 Answers2

17

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

sɐunıɔןɐqɐp
  • 3,332
  • 15
  • 36
  • 40
LarsTech
  • 80,625
  • 14
  • 153
  • 225
5

Set the IntegralHeight property of the listbox to false

APrough
  • 2,671
  • 3
  • 23
  • 31