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. Making A CFont Go Bold

Making A CFont Go Bold

Scheduled Pinned Locked Moved C / C++ / MFC
4 Posts 3 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
    AJ123
    wrote on last edited by
    #1

    I am trying to make the text bold in a CStatic. I wrote the following code, Can anyone see where i am going wrong. CFont *M_titleFont is a member varible. Code Snippet, from oninitdialog: LOGFONT lf; m_titleFont->GetLogFont(&lf); lf.lfWeight = 700; //Set Bold m_titleFont->CreateFontIndirect(&lf); Cheers Rich

    T 1 Reply Last reply
    0
    • A AJ123

      I am trying to make the text bold in a CStatic. I wrote the following code, Can anyone see where i am going wrong. CFont *M_titleFont is a member varible. Code Snippet, from oninitdialog: LOGFONT lf; m_titleFont->GetLogFont(&lf); lf.lfWeight = 700; //Set Bold m_titleFont->CreateFontIndirect(&lf); Cheers Rich

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

      How do you initialize m_titleFont? Tomasz Sowinski -- http://www.shooltz.com

      A 1 Reply Last reply
      0
      • T Tomasz Sowinski

        How do you initialize m_titleFont? Tomasz Sowinski -- http://www.shooltz.com

        A Offline
        A Offline
        AJ123
        wrote on last edited by
        #3

        Oops Missed That Bit Out! m_titleFont= GetDlgItem(IDC_TITLE)->GetFont(); Thanks Again Rich

        F 1 Reply Last reply
        0
        • A AJ123

          Oops Missed That Bit Out! m_titleFont= GetDlgItem(IDC_TITLE)->GetFont(); Thanks Again Rich

          F Offline
          F Offline
          fantastic_mr_fox
          wrote on last edited by
          #4

          I found I had problems using CreateFontIndirect() with an existing font. But it was easier to create a new font instead. LOGFONT lf; m_titleFont->GetLogFont(&lf); lf.lfWeight = 700; //Set Bold CFont boldFont; bolFont.CreateFontIndirect(&lf); // continue to use boldFont Hope this helps. =) =)

          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