Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC CTreeCtrl.
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.
 

----
Thanks.
 
Max.
Posted 21-Aug-12 5:00am
Maximilien75.1K
Edited 21-Aug-12 8:05am
v4
Comments
Marcus Kramer at 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
good
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 445
1 Suvendu Shekhar Giri 134
2 Abhinav S 126
3 Maciej Los 125
4 Peter Leow 120
0 Sergey Alexandrovich Kryukov 9,623
1 OriginalGriff 8,870
2 Peter Leow 4,984
3 Kornfeld Eliyahu Peter 3,300
4 Maciej Los 2,456


Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 21 Aug 2012
Copyright © CodeProject, 1999-2015
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