Solved

Changing Fonts in CTreeCtrl

Posted on 1997-06-17
3
606 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now