Changing TreeView nodes font dynamically

G

Guest

If I change the font style of a tree node to bold it's text appears clipped
because the width of the text is expanded.
If I do the font change between BeginUpdate and EndUpdate it works OK.
Is this the "normal" way of changing the font of a single node ?

Thanks
 
T

Terp

Ted-BG said:
If I change the font style of a tree node to bold it's text appears clipped
because the width of the text is expanded.
If I do the font change between BeginUpdate and EndUpdate it works OK.
Is this the "normal" way of changing the font of a single node ?


Ted,
The best way to handle this problem is to set the font of the TreeView
control itself to be bold. Then as you build the tree, turn bold on or off
as you need. This way, the treeview "allows" for the added width in bold,
and you have plenty of room for the non-bold text.

Chris
 
G

Guest

Ted,
The best way to handle this problem is to set the font of the TreeView
control itself to be bold. Then as you build the tree, turn bold on or off
as you need. This way, the treeview "allows" for the added width in bold,
and you have plenty of room for the non-bold text.

Chris

Thanks Chris
I used to do so, but it is not very nice. Also it seems that the control
remeasures all node labels after each call of BeginUpdate() - EndUpdate()
functions so if I add a set of nodes within a begin...-end... block all will
appear correctly for the explicit font style I used while inserting (say
"Regular") despite the tree settings.
But later when I change the fontstyle of a node (say to "Bold") it will not
remeasure unless I use BeginUpdate-EndUpdate.
The good news is that it works, the bad news is that it is just weird :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top