Link to home
Start Free TrialLog in
Avatar of PostMan
PostMan

asked on

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
Avatar of AVaulin
AVaulin
Flag of Ukraine image

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.
Avatar of PostMan
PostMan

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of jaba
jaba

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial