Say I have a ListBox
control having ID myList
, to which I've added 50 items. The vertical scrollbar is inevitably displayed on the right-side of the control. Two related questions:
How do I determine at runtime what value to set
myList.Height
to so that the scrollbar will NOT be displayed?How do I determine the height that one row requires (with padding)?
The value of myList.ClientSize.Height
changes if the font is changed (for internationalisation), so this needs to be dynamic when the form loads.
Note: If you are wondering "Why remove the scrollbar?", I intend to handle scrolling separately by placing the ListBox
on a parent control and modifying myList.Top
in response to clicks on Up/Down Buttons.