Solved

Changing font of a tree control item

Posted on 1998-12-30
2
410 Views
Last Modified: 2013-12-03
Pretty basic question but I just started learning a few days ago and I don't have a book or any source of help besides the .hlp files vc++ 5.0 came with, so be nice :)  Ok, I created and added an item my tree control, but not how can I use SetItem() to change the font of the item to bold?  For example, I have this:

HTREEITEM a = m_tree.InsertItem(title, TVI_ROOT, TVI_LAST);

with m_tree and titled taken care of.  Now, if I want to turn that item bold I do something along the lines of this (help me - fill in the ?s and make any needed corrections please =), oh and btw, I dont have images on the tree):

m_tree.SetItem(a, TVIF_STATE, title, 0?, 0?, TVIS_BOLD?, TVIS_BOLD?, ?)

I would really appreciate help with this.  Thanks alot,

-Chris
0
Comment
Question by:core123
2 Comments
 

Author Comment

by:core123
ID: 1327039
Edited text of question
0
 
LVL 1

Accepted Solution

by:
dd_b earned 50 total points
ID: 1327040
Dear core123,

I also faced the same problem , here r some clue.

1)
what u can do is - get the window handle of your control in your intiDialog or OnInitialUpdate & then u can send following message

An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text.

WM_SETFONT
wParam = (WPARAM) hfont;            // handle of font
lParam = MAKELPARAM(fRedraw, 0);    // redraw flag

2) with control window handle invoke this function

CWnd::SetFont

void SetFont( CFont* pFont, BOOL bRedraw = TRUE );

All the best

dd_b
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…

803 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