473,563 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.BackCo lor.

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

regards,
Sean
Nov 16 '05 #1
2 4331
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*******@disc ussions.microso ft.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.BackCo lor.

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*******@disc ussions.microso ft.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.BackCo lor.

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
5222
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 box that remains at the last node of each level of the Tree. I am using a treeView with an ImageList "+" "-".\ I used the following suggestions...
0
1880
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 several of the TreeNodes in the TreeView but now, on those changed nodes, the underline from the HotTracking no longer appears on the screen (but,...
1
16826
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 is: private void ChangeServantStatus(string servant, ServantStatus status) {
0
1853
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
1875
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! Rogers.
1
3248
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 focus. I could just not use the HideSeletion property and change the node color when I Leave or Enter the tree control, but there are often more...
4
584
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 BackgroundImage property, but this does not seem to work. I'm using C# Express 2008. Does anybody here have any solutions?
2
7359
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 class xtree : System.Windows.Forms.TreeView
4
6809
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 background colour of the currently selected item to red. Lets say in this case it was the 3rd row. The 3rd row is still the current item, so its...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.