Click here to Skip to main content
13,094,001 members (53,556 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Changing to state of tree item to BOLD does not change the size of the displayed string.

(VS2008, MFC, feature-pack).

I created a CTreeCtrl and filled it with some data; the items are "drawn" dynamically with the handle of NM_CUSTOMDRAW and in the CDDS_ITEMPREPAINT, I set the item state to bold of certain items with :

SetItemState(hItem, TVIS_BOLD, TVIS_BOLD);

This does work most of the time when the tree is filled and I manually change the state of the certains other items, but when the tree is initialized, the first item that is set to bold have its text/label clipped.

It seems the "new" CTreeCtrl (common control ver. 6 ?) changes the behaviour of the custom drawing of the tree.

One solution found in the web, is to change the common control version of the Tree to 5 with the message CCM_SETVERSION. but this does not seems to work.
I send the message to the tree just after I create it.

Anyone have issues with custom drawing a tree control ?

Fix: I had to reset the string of the item after the bold state was set to the item.


Posted 21-Aug-12 4:00am
Updated 21-Aug-12 7:05am
Marcus Kramer 21-Aug-12 14:11pm
Hey Maximilien, you should add your fix as a solution so that someone searching can see clearly that an answer was found. (The side bonus is that OPs who provide their solution usually get a lot of upvotes for providing that completion to the query)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Fix: I had to reset the string of the item after the bold state was set to the item.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 21 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100