Click here to Skip to main content
12,455,917 members (80,236 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ MFC
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 4:00am
Maximilien81.2K
Updated 21-Aug-12 7:05am
v4
Comments
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
 
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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 21 Aug 2012
Copyright © CodeProject, 1999-2016
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