I am developing a dialog-based Win32 application with Visual C++ 6.0.
I recently encountered a problem when testing my software in computers with
different OS and screen settings such as the font size. For Win2K, my
application only works small font, when under big font, the following
problem were observed:
1) The size of Bitmap necomes smaller than the size of dialog.
2) The text of ComboBox control looks smaller.
3) The plots I draw with GDI object deviate from their original locations.
For WinXP, different size of DPI will cause same problems.
Does anybody know how to make my application work for both cases?
I replaced the default "MS Sans Serif" font with "MS Shell Dlg" in the
resource file as Sev suggested, but it does not help. I also inserted a
placeholder for all bitmaps as Alexander suggested, and it worked. However,
I would like to know if there is any easier way for my application to
support different font settings.
John
Tim Robinson - 30 Nov 2004 12:10 GMT
[...]
> 1) The size of Bitmap necomes smaller than the size of dialog.
> 2) The text of ComboBox control looks smaller.
[quoted text clipped - 3 lines]
>
> Does anybody know how to make my application work for both cases?
[...]
There are a couple of ways:
-- Look at GetSystemMetrics(SM_LOGPIXELSX) and SM_LOGPIXELSY to obtain
the number of pixels per inch in each direction
-- Computer your measurements relative to the pixel size of
GetStockObject(DEFAULT_GUI_FONT), which depends on SM_LOGPIXELSX/Y
See "DPI Problem on dialogs" (microsoft.public.win32.programmer.ui, 25
Nov 2004) for what happens to dialog boxes. I recommend that you code to
cope with changing DPI settings, instead of resizing your dialogs,
controls and fonts to what you expect them to be.
A good habit is to develop with a setting of Large Fonts, then use Small
Fonts occasionally to test.

Signature
Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/