470,632 Members | 2,554 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,632 developers. It's quick & easy.

Custom Drawn Treeview

I have created a transparent custom drawn treeview in c#(using lots of native code as well) that has a bitmap for its background. As well as that, I have created a custom highlight that is a different shape than the default treeview selection highlight. I catch NM_CUSTOMDRAW and in the CDDS_PREPAINT draw stage, I draw the bitmap and return the result CDRF_NOTIFYITEMDRAW

In the CDDS_ITEMPREPAINT drawstage I set the background mode to transparent, use the graphics object I receive from the NMTVCUSTOMDRAW structure available when Custom drawing and draw the non-selected nodes text. I return CDRF_SKIPDEFAULT to stop the default treeview painting

When the user clicks on a node, I need to highlight it with a eliptical highlight that I draw onto the tree. I do this in the CDDS_ITEMPREPAINT drawstage.Everything works fine EXCEPT...when I select a treenode, the previously selected and newly selected node flash a white band across the treeview. It is the width of the treeview and the hight of the node. Then my custom drawn highlight changes to the new selection.

My question is this - in c# or the native API (I have tried catching every WM_message I can think of and handle it) is there a way to stop the background of the previous and newly selected items from repainting. I have tried handling the following


and others with no success. I also tried to create a transparent solid brush for WM_CTLCOLOREDIT and return it but this crashed the application

Any suggestions would be appreciated as I have worked on this solidly for two weeks with limited success - I was able to stop one of the repaints

Nov 22 '05 #1
0 1516

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Steve | last post: by
1 post views Thread by Phil Price | last post: by
10 posts views Thread by Lex | last post: by
8 posts views Thread by JJBean | last post: by
15 posts views Thread by Tinus | last post: by
2 posts views Thread by Eamon Millman | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.