PC Review


Reply
Thread Tools Rate Thread

Change colors of ProgressBar control?

 
 
Zytan
Guest
Posts: n/a
 
      8th May 2007
I am trying to change the colors of the ProgressBar control, using
ForeColor and BackColor, but this doesn't do anything. Does anyone
know why? I wonder if it has anything to do with Windows insistence
on drawing the ProgressBar with the block display, instead of one
smooth bar, even if you ask it to do otherwise?

Zytan

 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      9th May 2007
How are you telling it to show one smooth bar?


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"Zytan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am trying to change the colors of the ProgressBar control, using
> ForeColor and BackColor, but this doesn't do anything. Does anyone
> know why? I wonder if it has anything to do with Windows insistence
> on drawing the ProgressBar with the block display, instead of one
> smooth bar, even if you ask it to do otherwise?
>
> Zytan
>



 
Reply With Quote
 
Zytan
Guest
Posts: n/a
 
      9th May 2007
> How are you telling it to show one smooth bar?

I have no idea. I guess I never tried doing it in C#, only in C++.
Is it possible to ask for this in C#? I can't find it anything under
appearance options.

Zytan


 
Reply With Quote
 
Zytan
Guest
Posts: n/a
 
      9th May 2007
You can, like this:
progressBar1.Style = ProgressBarStyle.Continuous;
But, it doesn't work. I remember trying this before.

The docs say: "The Continuous style is valid only when visual styles
are not enabled."

Zytan

 
Reply With Quote
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      9th May 2007
Zytan,

The templates for a Windows Forms app for VS.NET 2005 puts the following
line into your code by default:

Application.EnableVisualStyles();

This says that you want to use visual styles in your application,
meaning that the .NET wrappers for common controls will use version 6, which
supports styling of the controls depending on theme and whatnot.

If you take this line out, you can set the value for the Style property
and get the smooth progress bar. However, the rest of the app will not have
visual styles set, which will look pretty out of place on Windows XP or
above.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)


"Zytan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You can, like this:
> progressBar1.Style = ProgressBarStyle.Continuous;
> But, it doesn't work. I remember trying this before.
>
> The docs say: "The Continuous style is valid only when visual styles
> are not enabled."
>
> Zytan
>



 
Reply With Quote
 
Zytan
Guest
Posts: n/a
 
      9th May 2007
> The templates for a Windows Forms app for VS.NET 2005 puts the following
> line into your code by default:
>
> Application.EnableVisualStyles();


Oh, I didn't realize I had control over that, I thought it was a
global setting in WinXP.

> This says that you want to use visual styles in your application,
> meaning that the .NET wrappers for common controls will use version 6, which
> supports styling of the controls depending on theme and whatnot.


Yes.

> If you take this line out, you can set the value for the Style property
> and get the smooth progress bar. However, the rest of the app will not have
> visual styles set, which will look pretty out of place on Windows XP or
> above.


Right, and that's no good. Thanks, Nicholas. I guess ProgressBars
are one thing Microsoft doesn't want us to mess with.

Zytan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ProgressBar Control Ayo Microsoft Excel Misc 3 18th Oct 2008 07:24 AM
How to change the colors of a diabled control grog Microsoft Access Forms 3 1st Aug 2006 10:19 PM
Can I change INDIVIDUAL tab control colors in Access? =?Utf-8?B?Q3J5c3RhbCBLZWxseQ==?= Microsoft Access Forms 1 4th May 2005 06:36 PM
Re: Change GUI Control colors Maarten Struys, eMVP Microsoft Dot NET Compact Framework 1 9th Jan 2004 02:49 PM
Progressbar control Steven Smith Microsoft VB .NET 2 18th Nov 2003 03:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:42 PM.