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. Fonts and MFC

Fonts and MFC

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionc++com
3 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.
  • R Offline
    R Offline
    Rafael Fernandez Lopez
    wrote on last edited by
    #1

    How can I set a Font to a CWnd object with SetFont ?? I try with method GetLogFont, but I don't know how to build a LOGFONT object. Please if you could give me an example... (For Example: Tahoma, size 12).Thank you. :confused:


    MaestroProgramador.Com Where every source code is loved like a girl.

    P 1 Reply Last reply
    0
    • R Rafael Fernandez Lopez

      How can I set a Font to a CWnd object with SetFont ?? I try with method GetLogFont, but I don't know how to build a LOGFONT object. Please if you could give me an example... (For Example: Tahoma, size 12).Thank you. :confused:


      MaestroProgramador.Com Where every source code is loved like a girl.

      P Offline
      P Offline
      Peter Mares
      wrote on last edited by
      #2

      Try this: CFont tahomaFont; tahomaFont.CreatePointFont(120, "Tahoma"); // 12 pt * 10 YourCWndObject.SetFont(&tahomaFont); That should work. A really good idea is to store your font objects as member variables of a class so you can clean up after yourself at the destructor phase. Hope this helps


      www.kinkycode.com [Glossary Manager] [AfterThought Backup Lite] 99 little bugs in the code, 99 little bugs, Fix 1 bug, recompile.... 101 little bugs in the code...

      R 1 Reply Last reply
      0
      • P Peter Mares

        Try this: CFont tahomaFont; tahomaFont.CreatePointFont(120, "Tahoma"); // 12 pt * 10 YourCWndObject.SetFont(&tahomaFont); That should work. A really good idea is to store your font objects as member variables of a class so you can clean up after yourself at the destructor phase. Hope this helps


        www.kinkycode.com [Glossary Manager] [AfterThought Backup Lite] 99 little bugs in the code, 99 little bugs, Fix 1 bug, recompile.... 101 little bugs in the code...

        R Offline
        R Offline
        Rafael Fernandez Lopez
        wrote on last edited by
        #3

        Thank you so much, it was very helfully. It sent me an assert error, but I solved it with: CFont* my_font = new CFont; my_font->CreatePointFont(120, "Tahoma"); Thank you so much !! :)


        MaestroProgramador.Com Where every source code is loved like a girl.

        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