473,545 Members | 2,048 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 4328
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
5221
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
1876
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
16822
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
1874
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
7357
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
7470
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7405
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
7811
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...
0
7760
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5334
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4949
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
3455
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
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1887
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

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.