Thread: Setting DEFAULT_GUI_FONT

  1. #1

    Setting DEFAULT_GUI_FONT

    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?

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You use that with GetStockObject().

    gg

  3. #3
    lol, didn't make myself clear enough I guess ...

    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.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    I'll assume you mean this:
    Code:
    SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0));
    >> I gather because I'm supposed to handle it myself or something I have no idea.

    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

  5. #5
    I use the DrawText function in my paint procedure, how would I go about changing the font?

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    from MSDN...

    Remarks
    The DrawText function uses the device context's selected font, text color, and background color to draw the text.
    Use SelectObject() to "select" another font for your DC.

    gg

  7. #7
    Oh sweet, I knew I could do that for pens and brushes but not for fonts.

    Thanks again oh wise and gracious codeplug!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. VS .net project setting question
    By Jumper in forum C++ Programming
    Replies: 1
    Last Post: 05-13-2004, 11:03 AM
  4. Your favourite fantasy game setting?
    By fry in forum Game Programming
    Replies: 4
    Last Post: 10-16-2002, 06:26 AM
  5. Setting the background color of my main window
    By Garfield in forum Windows Programming
    Replies: 5
    Last Post: 07-06-2002, 11:25 PM