I'm making my own controls and I want to use the DEFAULT_GUI_FONT but if I send the message it never gets applied, I gather because I'm supposed to handle it myself or something I have no idea.
So what do I have to do?
Printable View
I'm making my own controls and I want to use the DEFAULT_GUI_FONT but if I send the message it never gets applied, I gather because I'm supposed to handle it myself or something I have no idea.
So what do I have to do?
You use that with GetStockObject().
gg
lol, didn't make myself clear enough I guess :D...
I know how to send the message and to use GetStockObject(DEFAULT_GUI_FONT) in the WPARAM but when I send it the font in my control stays the same, ie the big chunky font.
I'll assume you mean this:
>> I gather because I'm supposed to handle it myself or something I have no idea.Code:SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0));
That depends on if you've subclassed a control that handles this message in the first place, and wether are not you're allowing the message to be handled by the original window proc.
If you are rendering any text, the you must handle the message for that text to change font.
gg
I use the DrawText function in my paint procedure, how would I go about changing the font?
Use SelectObject() to "select" another font for your DC.Quote:
from MSDN...
Remarks
The DrawText function uses the device context's selected font, text color, and background color to draw the text.
gg
Oh sweet, I knew I could do that for pens and brushes but not for fonts. :)
Thanks again oh wise and gracious codeplug!