I’ve got a treeview that is populated in 3 levels.
I’ve added in each group level the number of childs it has.
Now I want to set the that number in a different color or in bold.
Example:
tree [3]
|_ firstGroup [2]
|_ firstChild
|_ secondChild
|_ secondGroup [1]
|_ thirdChild
this is a windows forms application.
I think it isn’t possible, but I want to be sure.
I think you can do this by setting the TreeView control’s DrawMode to OwnerDrawText, and perform the drawing inside a
DrawNodeevent handler.Sample of DrawNode implementation (split the node string at space, draw the first element in bold, the rest of the string using regular font and if there is no space, we let the OS do the drawing instead):
Note: you may want to add a variable or property to the form that holds the bold font instead of recreating and disposing it for each TreeNode that is drawn.