Thread: Changing the font on static text and buttons

  1. #1

    Changing the font on static text and buttons

    Can someone give me an example of changing the font that is displayed on static text, buttons, edit boxes, etc. I would like to have the same font as the menu has (created through the resource wizard).

  2. #2
    Registered User
    Join Date
    Feb 2002
    might not want to listen to me cause i'm new to windows programming but... i'm currently working with dialog boxes and in my .rc file i wrote

    IDD_Exit DIALOG 150,300,100,75
    CAPTION "Enter Password"
    FONT 10, "MS Sans Serif"
        DEFPUSHBUTTON   "OK",IDOK,129,7,50,14
        PUSHBUTTON      "Cancel",IDCANCEL,129,24,50,14
        EDITTEXT        IDC_Password,17,24,104,14,ES_PASSWORD | ES_AUTOHSCROLL
        LTEXT           "Enter the password",IDC_Static,17,7,86,10
    which allows me to set the font for buttons and text boxes in the dialog box... not sure if this helps at all.. might wanna wait for someone who knows what they are talking about

  3. #3
    My bad: I should have stated that the text and buttons that I want to change are created dynamically with CreateWindowEx(). Is there a way to change the font from the SYSTEM_FONT to ARIAL before the control is created, thus the control would be displayed with the newly selected font?

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Have a look at the attached, it should get you going.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  2. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  3. how to change font of button's caption using MFC
    By urvashi in forum Windows Programming
    Replies: 5
    Last Post: 04-27-2004, 06:09 AM
  4. 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
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM