Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to set font

How to set font

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Al_Pennyworth
    wrote on last edited by
    #1

    Hey, I posted this once and I am hoping to get some suggestions this time. If nobody knows, hey, that is life. I am trying to set the font/color, etc, for text in a multiline text editor. The user can highlight as many lines (or chars) as he/she wants, and then change all the text that has been selected to the font/color. The problem is that it is not working. I get the font characteristics, then call EM_SETCHARFORMAT with the SCF_SELECTION. According to MS website, this will change all the selected text. It doesn't. It seems, when there is a carriage return or word wrap of some kind, it cannot handle these characters. So it only changes 1 line. I do not know how to get around this. I have used EM_EXGETSEL and then send EM_EXSETSEL, this doesn't help either. Does anybody have any ideas? I have no clue how to get around the word break chars.

    F A 2 Replies Last reply
    0
    • A Al_Pennyworth

      Hey, I posted this once and I am hoping to get some suggestions this time. If nobody knows, hey, that is life. I am trying to set the font/color, etc, for text in a multiline text editor. The user can highlight as many lines (or chars) as he/she wants, and then change all the text that has been selected to the font/color. The problem is that it is not working. I get the font characteristics, then call EM_SETCHARFORMAT with the SCF_SELECTION. According to MS website, this will change all the selected text. It doesn't. It seems, when there is a carriage return or word wrap of some kind, it cannot handle these characters. So it only changes 1 line. I do not know how to get around this. I have used EM_EXGETSEL and then send EM_EXSETSEL, this doesn't help either. Does anybody have any ideas? I have no clue how to get around the word break chars.

      F Offline
      F Offline
      Fred D
      wrote on last edited by
      #2

      have a look to this article : http://www.codeproject.com/staticctrl/clabel.asp and also : CFont & LOGFONT where you can specified the type of font etc. Fred

      1 Reply Last reply
      0
      • A Al_Pennyworth

        Hey, I posted this once and I am hoping to get some suggestions this time. If nobody knows, hey, that is life. I am trying to set the font/color, etc, for text in a multiline text editor. The user can highlight as many lines (or chars) as he/she wants, and then change all the text that has been selected to the font/color. The problem is that it is not working. I get the font characteristics, then call EM_SETCHARFORMAT with the SCF_SELECTION. According to MS website, this will change all the selected text. It doesn't. It seems, when there is a carriage return or word wrap of some kind, it cannot handle these characters. So it only changes 1 line. I do not know how to get around this. I have used EM_EXGETSEL and then send EM_EXSETSEL, this doesn't help either. Does anybody have any ideas? I have no clue how to get around the word break chars.

        A Offline
        A Offline
        Alexandru Savescu
        wrote on last edited by
        #3

        I think it will be much easier should you use a rich edit control. Best regards, Alexandru Savescu

        T 1 Reply Last reply
        0
        • A Alexandru Savescu

          I think it will be much easier should you use a rich edit control. Best regards, Alexandru Savescu

          T Offline
          T Offline
          Tomasz Sowinski
          wrote on last edited by
          #4

          LOL ;P Tomasz Sowinski -- http://www.shooltz.com

          - It's for protection
          - Protection from what? Zee Germans?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups