Converting between different font sizes
Posted on 2003-02-24
I have got a problem with dialog sizes in different sizes of font (set in Display properties in Control panels). I have normally set a Large (120dpi) font and my dialog has a width of 512 px. When I set a Small (96dpi) font, it has 387 pixels. I receive font size via GetDeviceCaps(hdc, LOGPIXELSX). I need to convert between these logical sizes of fonts - ie. I need the answer for: "If my dialog has 400px width using a 96dpi font, what width it will have when I set a 110dpi/120dpi/... font?". Logically, I thought, that is a 20/96=125 per cent larger....but 512/387=132 per cent larger! I'm totally confused. So...how can I convert sizes of dialog boxes/controls/etc. between different font settings?
Thank you very much,