Home All Groups Group Topic Archive Search About

change progressbar bar color

Author
23 Jun 2006 3:03 AM
iwdu15
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
--
-iwdu15

Author
23 Jun 2006 4:45 AM
ShaneO
iwdu15 wrote:
> 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.
Author
23 Jun 2006 2:39 PM
iwdu15
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?
--
-iwdu15
Author
23 Jun 2006 4:07 PM
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.

Ahmed
iwdu15 wrote:
Show quoteHide quote
> 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?
> --
> -iwdu15
Author
23 Jun 2006 9:58 PM
gene kelley
Show quote Hide quote
On 23 Jun 2006 09:07:50 -0700, "Ahmed" <ahmed1***@gmail.com> wrote:

>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.
>
>Ahmed
>iwdu15 wrote:
>> 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?
>> --
>> -iwdu15

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
Author
23 Jun 2006 11:24 PM
iwdu15
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
--
-iwdu15
Author
23 Jun 2006 11:16 PM
Herfried K. Wagner [MVP]
"iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
> 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.

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

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
24 Jun 2006 1:47 AM
gene kelley
On Sat, 24 Jun 2006 01:16:40 +0200, "Herfried K. Wagner [MVP]"
<hirf-spam-me-here@gmx.at> wrote:

>"iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
>> 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.
>
>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
Author
24 Jun 2006 9:31 AM
Herfried K. Wagner [MVP]
"gene kelley" <o***@by.me> schrieb:
>>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.

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

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
23 Jun 2006 11:20 PM
gene kelley
On Thu, 22 Jun 2006 20:03:02 -0700, iwdu15 <jmmgoalsteratyahoodotcom>
wrote:

>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