?
Solved

Changing Fonts in CTreeCtrl

Posted on 1997-06-17
3
Medium Priority
?
627 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 40 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

765 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