I’m making a little visualization based on a TreeView, but with some colorful graphics to show extra information.
I have a class which extends TreeView. I’ve added the control to a form and populated it with the nodes.
Now what I would like to do is to add some graphics to it. I would like to add a fixed width (say, 100px-wide, and the height of the text) graphic to the left of the text, but the right of the vertical indentation line.
How do I:
- Move the text over to the right by 100px to make room for the graphic, and
- Add the graphic at that particular location?
It is tempting to simply add spaces before the text, but I was hoping for a more elegant solution. Let’s say I can always fall back on spacing the text if I can’t find a better solution, I still need a way to determine the X,Y co-ordinates for where to place the graphic.
Thank you.
(I’m using C#2.0 with WinForms)
I believe this control has the two features you require (if not can you post a mock up screenshot): http://www.codeproject.com/Articles/13999/Using-treenodes-with-and-without-images-in-a-TreeV