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 change a font of static text

How to change a font of static text

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
6 Posts 6 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.
  • J Offline
    J Offline
    jadhav123
    wrote on last edited by
    #1

    Hello all, I have created static text dynamically on a dialog box. But it is displaying in different font. How to change the font to normal static text. Thanks in advance Regards, Aj

    N S H V D 5 Replies Last reply
    0
    • J jadhav123

      Hello all, I have created static text dynamically on a dialog box. But it is displaying in different font. How to change the font to normal static text. Thanks in advance Regards, Aj

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      First change the id of the static control from IDC_STATIC to some thing else say IDC_STATIC_NAME. Then call GetDlgItem( IDC_STATIC_NAME)->SetFont(.. ) to change the font.

      nave

      1 Reply Last reply
      0
      • J jadhav123

        Hello all, I have created static text dynamically on a dialog box. But it is displaying in different font. How to change the font to normal static text. Thanks in advance Regards, Aj

        S Offline
        S Offline
        Sarath C
        wrote on last edited by
        #3

        You can use GetFont and SetFont for getting and setting fonts. normally the child controls shows the font you have specfied in resource file. i.e. Dialog's font.

        SaRath.
        _"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"


        My Blog | Understanding State Pattern_

        1 Reply Last reply
        0
        • J jadhav123

          Hello all, I have created static text dynamically on a dialog box. But it is displaying in different font. How to change the font to normal static text. Thanks in advance Regards, Aj

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

          You can use like this m_YourControl.SetFont(GetFont()); or you can use CreateFont

          _**


          **_

          WhiteSky


          1 Reply Last reply
          0
          • J jadhav123

            Hello all, I have created static text dynamically on a dialog box. But it is displaying in different font. How to change the font to normal static text. Thanks in advance Regards, Aj

            V Offline
            V Offline
            Vipin Aravind
            wrote on last edited by
            #5

            If you are programming in plain win32, you will have to send a WM_SETFONT to the control to change the font. Vipin http://www.explorewindows.com/Blogs

            1 Reply Last reply
            0
            • J jadhav123

              Hello all, I have created static text dynamically on a dialog box. But it is displaying in different font. How to change the font to normal static text. Thanks in advance Regards, Aj

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              I show an example of this in the Extras section of this article.


              "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

              "Judge not by the eye but by the heart." - Native American Proverb

              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