?
Solved

Changing font of a tree control item

Posted on 1998-12-30
2
Medium Priority
?
414 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
[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
2 Comments
 

Author Comment

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

Accepted Solution

by:
dd_b earned 150 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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 …
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…
Suggested Courses

762 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