[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 638
  • Last Modified:

Changing Fonts in CTreeCtrl

Does any one know if CTreeCtrl supports .SetFont() method?

and if the answer is yes, I am trying to get the stock font property of an activeX control, then set use .SetFont() to set the CTreeCtrl obj to the stock font. Here's the code I came up with,

void CDriveTreeCtrl::OnFontChanged()
{
      CFont   font;
      CFontHolder* pFontHolder;
      HFONT   hFont;

      *pFontHolder = InternalGetFont();
      hFont            = pFontHolder->GetFontHandle();
      if(!hFont)MessageBox("NULL hFont");

      m_Tree.SetFont((font.FromHandle(hFont)),TRUE);

      
      COleControl::OnFontChanged();

  }

Would anyone know why it doesn't work?

-PostMan
0
PostMan
Asked:
PostMan
1 Solution
 
AVaulinCommented:
The easiest way to do what you want is using CFormView or CDialog class with consist tree control. Change font setting for dialog resource (which contain tree control) and see results.
0
 
PostManAuthor Commented:
The CTreeCtrl is not part of the Properties dlg, but part of the Control its self.  I don't think that I can use the CDialog class in this case, because the CTreeCtrl is part of the control.  Also at this point it would be alot of work to change to a CFormView...
So I don't think that I want to go that root.  -Thanks
0
 
jabaCommented:
Call COleControl::OnFontChanged() before you own processing. In First line of CDriveTreeCtrl::OnFontChanged(). BAse class handler changing contens of the CFontHolder object. What why you recive OLD font handle whe you using this object
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now