Change the Background color of TreeView

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Hi all,

I have a treeview and because I subclass the treeview and
allow multiple selection to be done on the treeview, I
have a problem changing the background color of the
treeview.

The problem is that after I multi-select the treenodes,
and I try to change the background color of the treeview,
those treenodes that have been multi-selected before still
maintain the previous background color. The rest of the
background change prefectly, only the bounds of those
previously selected nodes do not change.

I know that I can loop through all the nodes and change
the background color of the nodes but I don't understand
why this happens? Since everytime I reset the background
color of the nodes, I use the value treeView.BackColor.

Any suggestions will be greatly appreciated!
Thank you in advance.



regards,
Sean
 
I haven't tried this myself, so no guarantees, but it might be as simple as
invalidating the rectangle that represents the client area of the treeview.
Worth a try?

HTH,
Tom Dacon
Dacon Software Consulting
 
Hi Tom,

Thank you for your reply.
I have tried Invalidate, Refresh and Update
but none of them worked... :(


regards,
Sean
 
Back
Top