The height of my ComboBox and/or ListBox controls is out of sync

Last updated: January 21, 2007

Many of our customers have found that ComboBox and ListBox controls do not always stay in perfect proportion in terms of height. The reason is that these controls contain a property called "IntegralHeight". When the IntegralHeight property is true (the default) the height of these controls is determined by the text that they contain and not the height property. When IntegralHeight is true Visual Basic adjusts the height of each control so that it does not display fractional lines of text. The control will display 2, 3 or 4 lines of text but not 2 1/2 or 3 1/8 lines of text. This has caused some of our customers to conclude that ReSize has malfunctioned, but Visual Basic has simply overrode the control height determined and set by ReSize. You can change this behavior by setting the IntegralHeight property of ComboBoxes and ListBoxes to false.  In the case of the ComboBox, the IntegralHeight property applies only to the list portion of the control and not the text box portion. The text box portion of a ComboBox control will always display exactly one line of text. You can control the height of the text box portion of the control by controlling the font size. Since the default MS San Serif font does not scale very well you will get much better results with a True Type font such as Arial. While True Type fonts scale much better than the default MS San Serif font (a GDI font), they still do not scale in absolute perfect proportion to the form. Windows makes adjustments to the font size in an attempt to preserve the "aspect ratio" (the ration of height to width) of the font. Even though ReSize calculates what the exact proportion of the font should be, Windows may slightly alter this size.

Copyright © 2007 by Larcom and Young.
All rights reserved. Revised: January 21, 2007.