Question

The default dialog box font in Windows is MS Shell Dlg.

I don't like it, because it's not correct.

It's easy to manually change the font of a single dialog item, but how do I display a dialog box with the "correct" system font (from lfMessageFont) applied to all of its controls by default (not manually) when calling DialogBox (or using ATL/WTL)?

Note:

The reason I've said "not manually" so many times is that I am looking for a solution better than looping through everything with EnumChildWindows (or the like). Does one exist?

Was it helpful?

Solution

From About Dialog Boxes:

The system font can vary between different versions of Windows. To have your application use the system font no matter which system it is running on, use DS_SHELLFONT with the typeface MS Shell Dlg, and use the DIALOGEX Resource instead of the DIALOG Resource. The system maps this typeface such that your dialog box will use the Tahoma font. Note that DS_SHELLFONT has no effect if the typeface is not MS Shell Dlg.

I think this is what you want. If that doesn't work, then I guess you'll have to load the resource manually and modify the template before passing it to DialogBox.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top