change progressbar bar color

G

Guest

hi, is there any way (vb.net 2003 or 2005) to change the progress bar color
from blue to any other system color? im trying to change between 3 colors
depending on a variable in my app. unfortunatly i didnt see any property or
method to do this so i was wondering if i was missing something or if il have
to write my own. Thanks
 
S

ShaneO

iwdu15 said:
hi, is there any way (vb.net 2003 or 2005) to change the progress bar color
from blue to any other system color? im trying to change between 3 colors
depending on a variable in my app. unfortunatly i didnt see any property or
method to do this so i was wondering if i was missing something or if il have
to write my own. Thanks

ProgressBar1.ForeColor

or set the ForeColor Property in the Properties Window at Design Time.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
 
G

Guest

hi, im using VB 2005 and the forecolor property didnt change anything during
design time or run time. thnks though, does anyone kno how to change the
progress bar color?
 
A

Ahmed

As Shane mentioned,

You need to use the foreColor property. I just tried it with VS.NET
2005 and it is working and the color did change in design and run time.

Are you using the default progress bar? or did you inherit it to create
a custom control?

Let us know.
 
G

gene kelley

As Shane mentioned,

You need to use the foreColor property. I just tried it with VS.NET
2005 and it is working and the color did change in design and run time.

Are you using the default progress bar? or did you inherit it to create
a custom control?

Let us know.

Yes and no. I concur with the OP. Using a ProgressBar component
(VB2005), the properties Forecolor, Backcolor, and Style-Continuous
have no effect. The help file implies that those properties will only
work when a user's system is not using Visual Styles.

From the help file:
Forecolor changes for the ProgressBar will not be honored when visual
styles are enabled on Windows XP Home Edition, Windows XP
Professional, Windows Server 2003 and above.

The Continuous style is honored when visual styles are not enabled.

As was the case in VB6, the best alternative other than a 3rd party
control is still probably using a Label or PictureBox.

Gene
 
G

gene kelley

hi, is there any way (vb.net 2003 or 2005) to change the progress bar color
from blue to any other system color? im trying to change between 3 colors
depending on a variable in my app. unfortunatly i didnt see any property or
method to do this so i was wondering if i was missing something or if il have
to write my own. Thanks


This link may be of interest:
http://support.microsoft.com/?scid=kb;EN-US;323088

Gene
 
G

Guest

ohh ok...thanks, so in order to change the color, it cant have Visual styles,
aka look like the old school progress bar....thats disappointing, but thanks
for the responses
 
G

gene kelley

Setting a progressbar control's foreground and background color
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=setprogressbarcolors&lang=en>

I've seen this link before, myself. It's VB6 version worked fine in
VB6, but with Framework 2, it does not seem to work. The code
executes successfully, but the resulting progress bar displayed is
still the standard visual style green color.
Have you had this work in Framework 2, or is this an example from an
earlier version?

Gene
 
H

Herfried K. Wagner [MVP]

gene kelley said:
I've seen this link before, myself. It's VB6 version worked fine in
VB6, but with Framework 2, it does not seem to work. The code
executes successfully, but the resulting progress bar displayed is
still the standard visual style green color.

I assume the reason is that setting the color with visual styles turned on
doesn't have an effect.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top