Thread: Changing the font of the edit to Courier

  1. #1
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584

    Changing the font of the edit to Courier

    I know that I would sent the child wind a WM_SETFONT message, but what would the WPARAM be to set it to Courier? Thanks!
    1978 Silver Anniversary Corvette

  2. #2
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hey Garfield.

    I have some code at home to do this, but im at aschool at the moment so when i get back tonight i will put it up if no one has answered.

    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  3. #3
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hey ok here ya go:


    Make this fucntion:

    void SetEditFont(HWND hwndEdit, LPCSTR lpFontName, int FontSize, DWORD dwCharSet, BOOL bBold, BOOL bItalic, BOOL bUnderLine, BOOL bStrikeOut)
    {
    HFONT hFont;
    DWORD Bold = 200;
    if (bBold == TRUE) { Bold = FW_BOLD; }
    hFont = CreateFont(FontSize, 0, 0, 0, Bold, bItalic, bUnderLine, bStrikeOut,
    dwCharSet, 0, 0, PROOF_QUALITY, 0, lpFontName);
    SendMessage(hwndEdit, WM_SETFONT, (WPARAM)hFont, TRUE);

    }


    Then call it like this:

    SetEditFont(hWndEdit, "Courier", 0, ANSI_CHARSET, FALSE, FALSE, FALSE, FALSE);




    Worked for me

    Hope that helps, i havnt had time to test that code tonight, but i think its ok...

    Hope that helps
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  4. #4
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Thanks, buddy! I'll give it a whirl
    1978 Silver Anniversary Corvette

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Font of Objects on Form
    By carrotcake1029 in forum Windows Programming
    Replies: 0
    Last Post: 03-22-2009, 04:25 PM
  2. Font rendering in Direct3D
    By VirtualAce in forum Game Programming
    Replies: 3
    Last Post: 10-17-2005, 09:56 AM
  3. Changing font size of CStatic
    By earth_angel in forum Windows Programming
    Replies: 2
    Last Post: 08-12-2005, 10:51 AM
  4. Changing font in rich edit, without affecting undo buffer
    By jverkoey in forum Windows Programming
    Replies: 3
    Last Post: 01-17-2004, 08:54 PM
  5. changing edit control font
    By bennyandthejets in forum Windows Programming
    Replies: 6
    Last Post: 12-22-2002, 03:17 AM