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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to set text in different fonts in defferent lines of static text control

how to set text in different fonts in defferent lines of static text control

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
5 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.
  • B Offline
    B Offline
    Banks K
    wrote on last edited by
    #1

    I have created one static txt control and now I have to set text in multiple fonts in multiple lines I am creating and setting fonts like that: m_MyStaticText.Create("",WS_VISIBLE|BS_TEXT|WS_CHILD,CRect(0,0,520,58),this,IDC_STATICTEXT_PARTITION); if (TRUE == m_font.CreatePointFont( 140, _T ("MS Sans Serif"))) { m_MyStaticText.SetFont(&m_font); } m_MyStaticTextPartition.SetWindowText("\t\t\nPartition Selection"); but I have to set different font in different lines in this static text control. So can any body tell me how it is possible. thanks bankey

    R 1 Reply Last reply
    0
    • B Banks K

      I have created one static txt control and now I have to set text in multiple fonts in multiple lines I am creating and setting fonts like that: m_MyStaticText.Create("",WS_VISIBLE|BS_TEXT|WS_CHILD,CRect(0,0,520,58),this,IDC_STATICTEXT_PARTITION); if (TRUE == m_font.CreatePointFont( 140, _T ("MS Sans Serif"))) { m_MyStaticText.SetFont(&m_font); } m_MyStaticTextPartition.SetWindowText("\t\t\nPartition Selection"); but I have to set different font in different lines in this static text control. So can any body tell me how it is possible. thanks bankey

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      Banks K wrote:

      how it is possible

      I do not think it is. You will have to switch to a rich edit control for this, I think.

      Constantly "Saving the day" should be taken as a sign of organizational dysfunction rather than individual skill - Ryan Roberts[^]

      B 1 Reply Last reply
      0
      • R Rage

        Banks K wrote:

        how it is possible

        I do not think it is. You will have to switch to a rich edit control for this, I think.

        Constantly "Saving the day" should be taken as a sign of organizational dysfunction rather than individual skill - Ryan Roberts[^]

        B Offline
        B Offline
        Banks K
        wrote on last edited by
        #3

        thanks for youe quick response. can i set fonts for prticular line of text in rich edit text if it is possible than please tell me... thanks bankey

        I H 2 Replies Last reply
        0
        • B Banks K

          thanks for youe quick response. can i set fonts for prticular line of text in rich edit text if it is possible than please tell me... thanks bankey

          I Offline
          I Offline
          Iain Clarke Warrior Programmer
          wrote on last edited by
          #4

          Yes, you can set separate fonts for different parts of text in a RichEdit control. That can be different lines, different letters... Answering the question of "how" is far too long to reasonably expect someone to type here for you. But a search on codeproject will help. An article by Johan Rosengren I found very useful: CRulerRichEditCtrl - a complete RTF mini-editor[^] There are others in http://www.codeproject.com/richedit/[^] also. Good luck, Iain.

          1 Reply Last reply
          0
          • B Banks K

            thanks for youe quick response. can i set fonts for prticular line of text in rich edit text if it is possible than please tell me... thanks bankey

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            See here[^]


            WhiteSky


            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