Does any one have an example of an ownerdrawn treeview and/or listview?
Combo's and listboxes are no problem, but for some reason MS decided that we don't need that on treeviews and listviews.
But I hate the ImageList , especially if my nodes and items are dynamic. Even more so, if it's a filelist, so images are created at runtime. It's a drag to add them to the imagelist, and set the imageindex of the item all the time.
Also, when removing nodes and items, you need to clean up the imagelist to reduce memoryconsumption.
So I would appreciate it if anyone could guide me in the right direction.
PS. I have read a little about Custom Draw on MSDN, but it was some Windows SDK that I didn't get. Too much API.
Thanks.
I wish I could think of something witty to put in my sig...
Originally posted by CyberHawke There are definitely TreeView and ListView controls in .NET, I use them frequently.
I know that. I use them too. I was talking about the possibility for ownerdrawing them.
Combos and listboxes has a DrawMode property and DrawItem events, that allow me to render them my way.
Listviews and treeviews don't.
I wish I could think of something witty to put in my sig...
I've searched and there does not appear to be a paint method associated with these controls, so as far as I can tell, the answer to your question is no. Perhaps you can create a custom control that inherits this one but allows you to paint it. I would start there if I wanted to control the drawing of the control.
I allready tried to inherit both from the Treeview itself but also the treenode.
And none of them have the methods needed. The treeview does have a OnPaint, but that's the entire control, and there's no way to see which node is being painted.
I guess I have to subclass the control and catch the messages, but I have no idea where to begin on such an operation.
I just hoped that somebody else had done it before me, and were willing to share.
But thanks for trying anyway.
I wish I could think of something witty to put in my sig...