#listboxes & font size
16-Oct-91 01:22:07
Sb: #3264-#listboxes & font size
Fm: Keith Funk/Vanc.BC,CAN. 72240,2020
To: paul bonner 76000,13
Hi Paul,
Ordinary VB ListBox Controls always automatically adjust their height so
they don't chop the bottom off the last line in the box. This is what is
causing your list boxes to get smaller and smaller as you flip back and
forth between text sizes. But have you noticed that at some point, the
boxes stop getting smaller and just flip-flop between two heights, one
slightly smaller than the other? That is the box height grows slighly
smaller or slightly larger as you change text sizes. The change is just
enough to make sure that the last line in the box is completely displayed
from the top to the bottom of the line.
At this point, if you count the number of lines displayed in 8.25 size and
9.75 size, you will find that the ratio is around 1.2 which is very close
to the ratio of the text heights. It may even be exactly the same ratio if
you take into account leading.
Since there is no way within VB to disable the auto-sizing feature of List
boxes, I'd like to suggest that you set the box sizes so that they have
this 1.2 line count ratio if possible. Try setting your box height so that
it displays 22, 11 or 6 lines using 8.25 text. These heights should adjust
themselves only a slight amount so that at a text height of 9.75, the box
will display 18, 9 and 5 lines respectively.
The alternative is to force the List box height to a specified value before
changing the text height as in, List1.Height = 3100: List1.FontSize = 9.75.
Personally, I found this solution to be visually unappealing because it
made the box 'bounce' as it adjusted its size.
Has this made any sense?<g>…KeithF
There is 1 Reply.