Possible Duplicates:
How to set default font for all the windows in a Win32 Application?
Which Font is the default for MFC Dialog Controls?
I hate default Windows Api Window Font (it is the default system font , i think). I know how to change the font of an individual child, say a button. But isn’t there a way to change the font of the entire application so that I don’t have to use SendMessage(…WM_SETFONT) on every single widget in my program?
Code examples are welcomed. (I am using C++)
I explain all of this in quite a bit of depth here: Which Font is the default for MFC Dialog Controls? Definitely required reading for any Win32 developer who cares about getting the UI right.
There’s no way to set the font for an entire application. The best thing you can do is set the font for a parent window and take advantage of the fact that most controls will inherit their font from their parent. To make extra sure that this works, you can write your own simple
SendMessageToChildrenfunction like MFC offers, which just walks down through the children of a particular parent recursively and sends each of them theWM_SETFONTmessage.But
WM_SETFONTis really your only option here. You can’t set a font for an entire class like you can a background brush. Getting this right can be challenging, but I agree that it is a very important to try. The hallmark of an inconsistent UI and an unprofessional application is one that does not use the correct default GUI font. Windows Vista came along and complicated things even further by switching not only the face to Segoe UI, but the default size to 9 point.