AutoSize ListBox by position height

I use TableLayoutPanel for all my elements in the form. I use Dock Fill to automatically create TextBox and ListBox. TextBox fits perfectly in the TableLayoutPanel cell, but not in the ListBox. It automatically sorts by element height.

enter image description here

How to remove this gap between the bottom of the ListBox and the bottom of the form? I know that I can set the height of the ListBox to a specific value (for example, the height of an item in a ListBox is 16, 16 * 10 items = 160, 160 will match correctly), but are there any other solutions?
I am using C #.

+5
source share
2 answers

Set the ListBox property IntegralHeight = false; so that it does not resize the control with a variable element height.

+16
source

Set the IntegralHeight property to false

+4
source

Source: https://habr.com/ru/post/1411534/


All Articles