Thread: default font

  1. #1
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96

    default font

    I created (at runtime) a Tab Control, but it has an ugly "System" font on tabs. When I send to the control a WM_SETFONT message with NULL parameter, nothing changes. When I make a
    Code:
    GetStockObject(SYSTEM_FONT);
    calling to retrieve default font, I get the same "System" font. I use w2k, so there should be "Tahoma" (as you can read in MSDN) instead of "System". I tried to run the program on another computer with w98, but with the same result. How is it that GetStockObject simply doesn't work? I'd like my program to be adaptable.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    To get the font used by dialog box controls use GetStockObject(DEFAULT_GUI_FONT). To change the font using WM_SETFONT to one you have defined you need to create the font using either CreateFont or CreateFontIndirect. Remember to DeleteObject on any such HFONT when you are done with it, although you don't need to do so with those gdi objects returned from GetStockObject (nor is it harmful to do so).

    Hope that helps.

  3. #3
    Registered User larry's Avatar
    Join Date
    Sep 2001
    Posts
    96
    DEFAULT_GUI_FONT returns Sans Serif, but it's not the font used by dialog box controls - as far as I can see, dialog box controls use Tahoma. Buttons, edit boxes, combo boxes, etc... I think this doesn't solve the problem.

    Maybe I really have to use SYSTEM_FONT parameter as says MSDN. But there must be something wrong with GetStockObject function, because it doesn't return what it should with this parameter.
    Please excuse my poor english...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with default font in graphical mode
    By voldemarz in forum C Programming
    Replies: 16
    Last Post: 10-24-2008, 01:30 PM
  2. Changing default font in Emacs
    By dra in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 02-26-2008, 02:53 AM
  3. problem with my font manager
    By hannibar in forum C Programming
    Replies: 1
    Last Post: 03-07-2006, 08:03 AM
  4. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  5. setting default font to draw all further controls with
    By alandrums in forum Windows Programming
    Replies: 0
    Last Post: 12-03-2001, 10:31 PM