Font In Edit Box??

This is a discussion on Font In Edit Box?? within the Windows Programming forums, part of the Platform Specific Boards category; Hi Ppl, Is it possible to change the font within an edit box? im not using rich edit or anything. ...

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

    Smile Font In Edit Box??

    Hi Ppl,

    Is it possible to change the font within an edit box? im not using rich edit or anything.

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

  2. #2
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    I'm new to Windows programming, but I think that for that reason (and a couple of other text formatting reasons) you would use the rich edit. But don't quote me on this.

    --Garfield the Programmer
    1978 Silver Anniversary Corvette

  3. #3
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    This must be put in any WindowProc Message
    Code:
                 SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_SETFONT,
                (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0));
    DEFAULT_GUI_FONT is the default font. Change fonts by changing this to these:


    0: Bold text

    Code:
    ANSI_FIXED_FONT: Code Font(Courier)
    DEFAULT_GUI_FONT: Default Text

    for example, this creates an edit window with bold font:
    Code:
     switch(Message)
       {
          case WM_CREATE:
             CreateWindow("EDIT", "",
                WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE |
                   ES_WANTRETURN,
                CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                hwnd, (HMENU)IDC_MAIN_TEXT, g_hInst, NULL);
    
                 SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_SETFONT,
                (WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0));
          break;

  4. #4
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    So, what are the benefits of rich edit?

    --Garfield
    1978 Silver Anniversary Corvette

  5. #5
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    that it's a word processor, try writing HTML in one and you'll see what i mean

  6. #6
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    What do you mean?
    1978 Silver Anniversary Corvette

  7. #7
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    a word processor gives extra crap to make the stuff look good when you type stuff and stuff into the crap which makes the stuff.
    In otherwords....
    You know, in microsoft word, you can change the font sizes, the color, and stuff? well in notepad, you can't do that. Correct? If you open a document made in microsoft word in notepad, it comes out with code tags on it. Get it?

  8. #8
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    oh and tnt, at the top of your program put this:
    Code:
    #define IDC_MAIN_TEXT 1003

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with my font manager
    By hannibar in forum C Programming
    Replies: 1
    Last Post: 03-07-2006, 08:03 AM
  2. Multiline Edit Box Parser
    By The Brain in forum Windows Programming
    Replies: 6
    Last Post: 11-01-2005, 07:15 PM
  3. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  4. setting fixed floats in edit box
    By WaterNut in forum Windows Programming
    Replies: 4
    Last Post: 08-13-2004, 10:13 AM
  5. Limiting Characters in Edit Box :: MFC
    By kuphryn in forum Windows Programming
    Replies: 5
    Last Post: 06-02-2002, 11:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21