Thread: CreateFont arguments

  1. #1
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003

    CreateFont arguments

    Hey guys.

    I'm trying to learn win32 C++ programming. I was looking for a way to change the font for a button. After lenghy searching I found this:

    PHP Code:
    HFONT hMultiFont=CreateFont(24,12,0,0,700,0,0,0,0,0,0,0,0,TEXT("Times New Roman")); 
    I figured out how to get it to work and everything, and it changed the font fine. What I want to do now, however, is change the colour of the font used on the button.

    Unfortunately, I could not find a list with descriptions of the arguments for CreateFont, so I do not know what each of the numbers does.

    If anoyone could give me a list of the arguments, or another function that I could use to change the font (as well as colour) I would really appreciate it.

    ~ Paul

    Edit: And yes, I did search MSDN, but I couldn't find a proper description.

  2. #2
    Join Date
    Jan 2002
    For buttons, you will have to use an owner-drawn control, for other controls the various WM_CTLCOLOR* (eg WM_CTLCOLOREDIT; although there is a WM_CTLCOLORBTN message, it is useless for this purpose) messages can be used with SetTextColor to effect the change.

    Search this board - I think Adrianxw has posted an owner-drawn button example at least once in the past.

    Also read up on WM_DRAWITEM.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. GradeInfo
    By kirksson in forum C Programming
    Replies: 23
    Last Post: 07-16-2008, 03:27 PM
  3. command line arguments
    By vurentjie in forum C Programming
    Replies: 3
    Last Post: 06-22-2008, 06:46 AM
  4. NULL arguments in a shell program
    By gregulator in forum C Programming
    Replies: 4
    Last Post: 04-15-2004, 10:48 AM
  5. registry, services & command line arguments.. ?
    By BrianK in forum Windows Programming
    Replies: 3
    Last Post: 03-04-2003, 02:11 PM