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. Changing the font stly in CView

Changing the font stly in CView

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 2 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.
  • S Offline
    S Offline
    Sunayna
    wrote on last edited by
    #1

    How do I change the font style of the text in CView to the font style selected from the fontdialog?

    S 1 Reply Last reply
    0
    • S Sunayna

      How do I change the font style of the text in CView to the font style selected from the fontdialog?

      S Offline
      S Offline
      santhoshv84
      wrote on last edited by
      #2

      LOGFONT newlf; CFontDialog fd; if(fd.DoModal() == IDOK) { fd.GetCurrentFont(&newlf); setfont(newlf); UpdateData(FALSE); }

      The price of anything is the amount of life you exchange for it. Thanks and Regards. SANTHOSH V

      S 1 Reply Last reply
      0
      • S santhoshv84

        LOGFONT newlf; CFontDialog fd; if(fd.DoModal() == IDOK) { fd.GetCurrentFont(&newlf); setfont(newlf); UpdateData(FALSE); }

        The price of anything is the amount of life you exchange for it. Thanks and Regards. SANTHOSH V

        S Offline
        S Offline
        Sunayna
        wrote on last edited by
        #3

        Thanks. I have used this method, font style of the text is changed but the alignment of the text is not proper. How do I ensure that the text alignment isn't changed?

        S 1 Reply Last reply
        0
        • S Sunayna

          Thanks. I have used this method, font style of the text is changed but the alignment of the text is not proper. How do I ensure that the text alignment isn't changed?

          S Offline
          S Offline
          santhoshv84
          wrote on last edited by
          #4

          Hi, You can change the alignment using SetTextAlign(); pDCMem->SetTextAlign (TA_BASELINE);

          The price of anything is the amount of life you exchange for it. Thanks and Regards. SANTHOSH V

          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