Determine Height of text in TMenuItem to decide to what height to change the MenuItem via TMenuItem.OnMeasureItem

752 Views Asked by At

I use Borland C++ Builder 2009 and when a large font is used, the Menu items in MainMenu and Popup are too close to each other, text cut off on top and bottom even, when too big.

I understand I can change the height of the items with TMenuItem.OnMeasureItem but to what height should I set it ?

What's the best way to calculate an ideal height and how do I get the variables for it (e.g. height of text)?

1

There are 1 best solutions below

0
Miamy On

OnMeasureItem handlers suggests you default value in Height var parameter.

You can multiply this value by ratio of current screen PPI and default PPI for font size 100% (96), e.g. Height := Ceil(Height * Screen.PixelsPerInch / 96);