Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
5.00/5 (1 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.


----
Thanks.

Max.
Posted
Updated 21-Aug-12 7:05am
v4
Comments
fjdiewornncalwe 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

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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900