Solved

Changing Fonts in CTreeCtrl

Posted on 1997-06-17
3
617 Views
Last Modified: 2013-12-03
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
Comment
Question by:PostMan
3 Comments
 
LVL 4

Expert Comment

by:AVaulin
ID: 1302169
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
 

Author Comment

by:PostMan
ID: 1302170
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
 
LVL 3

Accepted Solution

by:
jaba earned 20 total points
ID: 1302171
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question