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

倖福魔咒の 提交于 2019-12-11 12:05:29

问题


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:


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);



来源:https://stackoverflow.com/questions/34324974/determine-height-of-text-in-tmenuitem-to-decide-to-what-height-to-change-the-men

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!