473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Change colors of ProgressBar control?

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

May 8 '07 #1
5 8081
How are you telling it to show one smooth bar?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Zytan" <zy**********@gmail.comwrote in message
news:11**********************@n59g2000hsh.googlegr oups.com...
>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

May 9 '07 #2
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
May 9 '07 #3
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

May 9 '07 #4
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]
- mv*@spam.guard.caspershouse.com
"Zytan" <zy**********@gmail.comwrote in message
news:11**********************@w5g2000hsg.googlegro ups.com...
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

May 9 '07 #5
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

May 9 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Jan Tuxen | last post by:
Jakob Nielsen in his most recent Alertbox (http://www.useit.com/alertbox/20040503.html) tells web authors to change the color of visited links. I agree to his purpose: Help users understand...
4
by: codemonkey | last post by:
TIA! I would like to know if there is a way to dynamically change the colors of Subform items? I have already set in place Conditional Formatting so each row has an alernating color scheme, but...
1
by: Geir Baardsen | last post by:
Hi! Is there any clear examples on how to use the Progressbar (6.0) in ms access 2000 anywhere? Me.Name
2
by: Thomas Kehl | last post by:
Hi! Does anyone have a tipp for me where can I found (or how can I programm) a "progressbar" which has a gradient and the color go from the left side to right and back ... I should have a...
3
by: Rene Sørensen | last post by:
Hi Is there a way to show text in/over a progressbar (like using a label with transparent background? Which hasn't worked for me, BTW)??? Rene
8
by: needin4mation | last post by:
Please consider: foreach (ListViewItem item in listViewFiles.Items) { // Display the ProgressBar control. pBar1.Visible = true; // Set Minimum to 1 to represent the first file being copied....
1
by: Mehr H | last post by:
I've been trying to figure out how i can embed a Windows.Forms.ProgressBar in my webform (aspx) file. I have tried putting a Windows.Forms.ProgressBar as public on a regular winform designer form...
1
by: Karen Grube | last post by:
Hi! I'm using a standard server side ASP.Net listbox control on a web form. The page is basically various shades of green. The listbox itself has a pale green background and forest green text...
9
by: iwdu15 | last post by:
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.