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. CTreeCtrl font size

CTreeCtrl font size

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

    Hi Everyone How do you increase the font size of the text in CTreeCtrl? thanks

    R 1 Reply Last reply
    0
    • A AnkushChopra

      Hi Everyone How do you increase the font size of the text in CTreeCtrl? thanks

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      You need to set a new font for the control. Normally I would do it something like this (assuming your control is part of a dialog)

      OnInitDialog()
      {
      LOGFONT lf;

      m_TreeCtrl.GetFont()->GetLogFOnt(&lf):

      lf.lfHeight += 2; // make font larger (check for -ve)
      m_Font.CreateFontIndirect(&lf);
      m_TreeCtrl.SetFont(&m_Font);
      }

      m_Font needs to be part of your dialog class as it needs to live at least as long as the tree control using it. After setting the font, the tree control should work quite happily with it. Roger Allen Sonork 100.10016 Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003

      Y 1 Reply Last reply
      0
      • R Roger Allen

        You need to set a new font for the control. Normally I would do it something like this (assuming your control is part of a dialog)

        OnInitDialog()
        {
        LOGFONT lf;

        m_TreeCtrl.GetFont()->GetLogFOnt(&lf):

        lf.lfHeight += 2; // make font larger (check for -ve)
        m_Font.CreateFontIndirect(&lf);
        m_TreeCtrl.SetFont(&m_Font);
        }

        m_Font needs to be part of your dialog class as it needs to live at least as long as the tree control using it. After setting the font, the tree control should work quite happily with it. Roger Allen Sonork 100.10016 Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003

        Y Offline
        Y Offline
        ywimmer
        wrote on last edited by
        #3

        thanks!!!

        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