Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Winform listbox doesn't anchor correctly

I don't know if this affects other controls but for listboxes and checkedlistboxes, the bottom of the listbox only resizes with the form at certain intervals.

Say I have a Form and a listbox that has a 2px gap from the edge of the form, on all sides and anchored on all four sides. Now if I drag-resize the form, the 2px gap on the bottom between the bottom of the listbox and the bottom inner edge of the form becomes like 5-6px gap then at 7px gap, it "snaps back" to the 2px gap.

Essentially, it's not resizing with the form smoothly, it resizes every X pixels so you can see the listbox bottom "jumping". Only affects the bottom.

like image 486
Jack Avatar asked Oct 12 '11 06:10

Jack


1 Answers

The control is attempting to resize itself so only complete items are displayed in the vertical axis. It's avoiding cutting off any displayed item.

To prevent this and to allow setting any height, set your list control's IntegralHeight property to false.

like image 98
Jay Riggs Avatar answered Sep 20 '22 20:09

Jay Riggs