Thread: All my controls text is bold!

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    32

    All my controls text is bold!

    Hi

    Oddly, the text on my buttons and in my edit boxes has all turned out bold. It there any way to rectify this? Here is the code is used to create a button:

    Code:
            HWND SaveBtn;
            SaveBtn = CreateWindow("BUTTON","&Save", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
                                   x+240,y+280,40,25,//x = 15, y = 70
                                   hwnd,
                                   (HMENU)BN_SAVE, //1102 is id
                                   GetModuleHandle(NULL),
                                   NULL
                                  );
    I'm only a beginner to windows programming, so I cannot spot any problem.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Controls created within the context of a dialog resource have the font of that dialog, controls created with CreateWindowEx have a different system font.

    To change the font of any control, send a WM_SETFONT message; to duplicate the 'typical' resource dialog based controls use:
    Code:
    SendMessage(hControl,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),MAKELPARAM(1,0));
    See GetStockObject for further information.

    You can enumerate child windows to set the fonts of multiple controls as described in this thread.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    32
    Thanks! It works; thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My text doesn't display
    By joeprogrammer in forum Game Programming
    Replies: 11
    Last Post: 02-23-2006, 10:01 PM
  2. Text adventure engine idea. thoughts?
    By suzakugaiden in forum Game Programming
    Replies: 16
    Last Post: 01-15-2006, 05:13 AM
  3. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  4. Replies: 1
    Last Post: 07-13-2002, 05:45 PM
  5. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM