468,554 Members | 1,435 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Change the Background color of TreeView

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
Nov 16 '05 #1
2 4079
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

"Sean" <an*******@discussions.microsoft.com> wrote in message
news:38****************************@phx.gbl...
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

Nov 16 '05 #2
Hi Tom,

Thank you for your reply.
I have tried Invalidate, Refresh and Update
but none of them worked... :(
regards,
Sean
-----Original Message-----
I haven't tried this myself, so no guarantees, but it might be as simple asinvalidating the rectangle that represents the client area of the treeview.Worth a try?

HTH,
Tom Dacon
Dacon Software Consulting

"Sean" <an*******@discussions.microsoft.com> wrote in messagenews:38****************************@phx.gbl...
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

.

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Robert Robinson | last post: by
1 post views Thread by Anthony Boudouvas | last post: by
reply views Thread by kiran | last post: by
2 posts views Thread by Rogers | last post: by
4 posts views Thread by =?Utf-8?B?UGF0cmlja1M=?= | last post: by
2 posts views Thread by slg | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.