Custom Drawn Treeview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    #1

    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_NOTIFYITEM DRAW

    In the CDDS_ITEMPREPAI NT 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_SKIPDEFAUL T 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_ITEMPREPAI NT drawstage.Every thing 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

    WM_SETREDRA
    WM_ERASEBKGN
    WM_CAPTURECHANG E
    WM_TIME

    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

    Steve
Working...