[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Visual Basic 6 Treeview

Posted on 2000-04-06
13
Medium Priority
?
541 Views
Last Modified: 2013-11-25
I am using the VB6 (SP3) treeview, but am expreriencing problems with the backcolor. When you change the "window" color from control panel, the treeview doesn't change apart from a small area to the left of any bottom non-root nodes.

If the treeview is disabled however, it works fine. The VB5 version also works perfectly.

If I use the API to manually change the back color, the control works apart from the small area to the left of any bottom non-root nodes.

I have experimented with the attached image list control, refreshing, hiding, redrawing, etc.

If the form is closed and reopened, the treeview displays the correct colour.

Does anyone know a way around this?
0
Comment
Question by:BobbyOwens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2695634
i tried to reproduce your error but couldnt.  I set my window color to blue and yellow. both times the treeview backcolor changed accordingly. i also use vb6(sp3). any other settings you have set that may be causing this?
0
 
LVL 2

Author Comment

by:BobbyOwens
ID: 2699854
I've tried this using 2 different development machines, and testing on a 3rd machine. (2xDesktop, 1xLaptop) and they all have the same symptoms.I have also tried a piece of example code to change the backcolor, and with no changes, the problem existed.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2700714
is this occurring in the VB development area or only as a compiled exe?  what is your color settings in the control panel?  256 color?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Author Comment

by:BobbyOwens
ID: 2701188
It occurs in both development and in the compiled EXE.

I haven't checked the colour depth, but it's probably 16/24 bit.
0
 
LVL 2

Author Comment

by:BobbyOwens
ID: 2703395
I've now tried all color depths available, and the problem still occurs!!
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2704298
hmmm...most definitely a puzzler...if you start a brand new project and add just a treeview to it with no data and change the window color through the control panel and then run your project (obviously with no code)  does the treeview's window color change?
0
 
LVL 2

Author Comment

by:BobbyOwens
ID: 2706902
tried that. Still had the same problem
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2706926
what code have you used to try and change it manually??  setsyscolors api?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2715108
I found this today while surfing the web for general VB info:

"In developing the VB6 common controls, the VB development team stopped using comctl32.dll as its basis for functionality. Instead, the team took the unprecedented steps of removing the VB OCX dependency upon comctl32.dll, and opted (wrongly in this author's view) to rewrite the functionality available in comctl32.dll v4.72 as the new VB6 mscomctl.ocx. This redesigned OCX is not dependant on the original Windows' common control dll, and no longer relies on it for any functionality. And in creating the OCX, its implementation has been tweaked to the point where some methods that do work against the VB5 common control implementation (which uses comctl32.dll) no longer function as expected using the VB6 common control (mscomctl.ocx).

The TreeView BackColour and ForeColour methods detailed here do not work the same under the VB6 mscomctl.dll-version of the common controls. Specifically, the ForeColor method fails to recolour all nodes; only the node losing focus exhibits the changed colour, momentarily, then reverts to the default WindowText colour. The BackgroundColour method will not colour the background area of the icon and text. FullRowSelect is available in the VB6-based control as a property."
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2715111
you can find that comment along with a small demonstration about setting colors on the treeview.  perhaps some solution will result from this nonsense (damn MS!)

http://www.mvps.org/vbnet/code/comctl/tveffects.htm
0
 
LVL 2

Author Comment

by:BobbyOwens
ID: 2719340
Thanks for the code. Unfortunately, it's identical to the way I was trying to set it manually. (and didn't work)
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 600 total points
ID: 2719344
As the article states it is a bug in the new mscomctl.ocx control so I'm afraid your stuck unless you work with the control in VB5..sorry
0
 
LVL 2

Author Comment

by:BobbyOwens
ID: 2730441
Although the solution wasn't found, at least I know that it is something that I am unable to control
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question