Hi,

I was wondering if there any other way beside 'loop with WM_SETFONT' to change font for all controls in a window?

Thanks.
Posted on 2005-07-03 13:26:50 by arafel
you can handle WM_CTLCOLOR* messages and try SelectObject()'ing the font on the DC given in wParam there
Posted on 2005-07-05 09:32:59 by comrade
Thanks comrade, but it's not exactly what I was looking for.

I looked for 'WM_SETFONT in a loop' alternative to reduce the overhead when setting font to numerous controls.
Using WM_CTLCOLOR* to do this probably wont reduce the overhead.
Isn't there anyway to set default font for a window so all the child controls will obtain the font automatically?
Posted on 2005-07-05 10:08:11 by arafel
only if u are using a dialog... but then internally i tihk there is still a WM_STEFONT loop in system code
Posted on 2005-07-05 10:27:08 by comrade
Trying EnumChildWindows function, and WM_SETFONT in EnumChildProc with hFont as parameter in lParam
Posted on 2005-07-06 21:15:11 by zara
...or maybe super-class it?
Posted on 2005-07-06 21:55:04 by ti_mo_n
zara,
With this method there is same overhead once again.


Arghh, there should be some way to set default font for a whole window. Before the window or dialogbox creation the system selects somehow which font to use, so maybe it could be modified in some structure before?
Posted on 2005-07-07 03:54:41 by arafel
By default, font of the dialog is applied to all controls within it. So, maybe it's considerable to load the dialog resource to the memroy manually, modify its font definition, and then put it to the screen by CreateDialogIndirect function. With this method, it's not able to set the font to italic and/or bold property, only the font name and its size can be specified, just like normal dialog template do.
Posted on 2005-07-07 21:52:54 by zara