Edit Controls Text Font

This is a discussion on Edit Controls Text Font within the Windows Programming forums, part of the Platform Specific Boards category; How do i change the size of the text typed in the edit control of a single line for an ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    610

    Edit Controls Text Font

    How do i change the size of the text typed in the edit control of a single line for an example?

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Quote Originally Posted by csonx_p View Post
    How do i change the size of the text typed in the edit control of a single line for an example?
    WM_SETFONT

    Careful not to leak the font, GDI resources are very limited.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by novacain View Post
    WM_SETFONT

    Careful not to leak the font, GDI resources are very limited.
    Thanx, how NOT to leak font?

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    When you're done with it, free it (remember that the font has to stay alive for as long as you're using it on your control, though).
    If you're using C++, RAII may help you do that.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by Elysia View Post
    When you're done with it, free it (remember that the font has to stay alive for as long as you're using it on your control, though).
    If you're using C++, RAII may help you do that.
    Do i always have to SelectObject(hdc, font) when using the font object? Guess my next question is if i didn't select the font into DC, can i just DeletObject(Font) without worrying about SelectObject(hdc, OldFont) back into DC...

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    Yeah, when drawing, but not when setting a font for a control, though.
    If you put the font into a control, you'll have to detach it first and then delete it, I think.
    Same for SelectObject. If you select it, then select back the old one before deleting it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by Elysia View Post
    Yeah, when drawing, but not when setting a font for a control, though.
    If you put the font into a control, you'll have to detach it first and then delete it, I think.
    Same for SelectObject. If you select it, then select back the old one before deleting it.
    Deleting deletes the font even from edit controls... So, maybe someone should tell how to do this properly without DCs

  8. #8
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    Well, I told you "do not delete it while you are using it."
    You mustn't delete the font while the control is using it.
    When you don't need it anymore, THEN you can delete it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

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, 07:03 AM
  2. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 01:59 PM
  3. Replies: 3
    Last Post: 07-23-2005, 08:00 AM
  4. How can I send a text string to an edit control
    By marc74 in forum Windows Programming
    Replies: 5
    Last Post: 01-06-2005, 09:14 PM
  5. I need help disabling Keyboard and Mouse input on Edit controls
    By Templario in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2003, 11:59 PM

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