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. Default font static control

Default font static control

Scheduled Pinned Locked Moved C / C++ / MFC
questionannouncement
2 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.
  • W Offline
    W Offline
    Wim Jans
    wrote on last edited by
    #1

    I'm in the middle of writing a control which will show some text. Now, if I just output the text using DrawText, my text is displayed using the default font, which is Arial bold I think. But I want to use the font that is used in a static control. This font is much smaller and not bold. I am able to use this font using CreateFont. But what if Ms decides to use a different font in a future version. This means I have to change my control to use a different font. What would be nice is if I should have a function that can determine the default font used for a static control. I looked on msdn but can't find such a function. So does anybody know if there is such a thing as GetSystemMetrics but then for fonts? Thanks Wim

    D 1 Reply Last reply
    0
    • W Wim Jans

      I'm in the middle of writing a control which will show some text. Now, if I just output the text using DrawText, my text is displayed using the default font, which is Arial bold I think. But I want to use the font that is used in a static control. This font is much smaller and not bold. I am able to use this font using CreateFont. But what if Ms decides to use a different font in a future version. This means I have to change my control to use a different font. What would be nice is if I should have a function that can determine the default font used for a static control. I looked on msdn but can't find such a function. So does anybody know if there is such a thing as GetSystemMetrics but then for fonts? Thanks Wim

      D Offline
      D Offline
      dabs
      wrote on last edited by
      #2

      WTL has a ATLGetDefaultGuiFont( ) which uses ::GetStockObject( DEFAULT_GUI_FONT ). I think this might be what you are looking for. Otherwise you could always require the users of your control to do a m_wndMyControl.SetFont( GetFont( ) ); after your control has been Create'd/Sublcass'ed, assuming m_wndMyControl is a member variable in a dialog - GetFont( ) returns the font of the dialog.


      Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!

      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