473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 4313
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert Robinson | last post by:
I have been working for the past week on what seems to be a bug with the VB TreeView control. I have changed the background of the treeview to a light beige, this works fine except for the white...
0
by: hzgt9b | last post by:
Using VS 2003, VB.NET: I have a TreeView control filled with TreeNodes. When I create the TreeView, I set HotTracking = True. Subsequently, I change the font (make the not bold versus bold) on...
1
by: Anthony Boudouvas | last post by:
Hi to all, i have a treeview that i put some nodes in it with their repsective images. If i try to change the image and set it to some other ImageList index, nothing happens. The code i use...
0
by: kiran | last post by:
How to set background image for treeview control or transparent color as a background for treeview control in Windows forms..? Regards kiran
2
by: Rogers | last post by:
Hi,everyone: I want to add a background image to treeview control on my asp.net page,or if I can make it to be transparent,that would be okay to.if there and way to implement it? Thank you! ...
1
by: Shane | last post by:
Is there a way to change the HideSelection color in a treeview? I'm using the treeview as a replacement of a tab control. The grey background doesn't stand out well enough, when the treeview loses...
4
by: =?Utf-8?B?UGF0cmlja1M=?= | last post by:
I'd like to be able to give a treeview in my application a nice smooth gradient as a background image, but I'm having trouble doing this. Webpages that I've seen so far seem to suggest using the...
2
by: slg | last post by:
iam looking for code snippet or a sample of drawing background image for a c# treeview control. I tried following but i could not see the tree nodes only the ellipse shows up. TIA public...
4
by: ari | last post by:
I have recently upgraded from vb.net 2002 to 2005, and have encountered the following problem. I have a listview with say a dozen items. Following a user action I programmatically update the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.