473,569 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8089
How are you telling it to show one smooth bar?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Zytan" <zy**********@g mail.comwrote in message
news:11******** **************@ n59g2000hsh.goo glegroups.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.St yle = ProgressBarStyl e.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.Ena bleVisualStyles ();

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.co m
"Zytan" <zy**********@g mail.comwrote in message
news:11******** **************@ w5g2000hsg.goog legroups.com...
You can, like this:
progressBar1.St yle = ProgressBarStyl e.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.Ena bleVisualStyles ();
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
10726
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 where they have been. I also agree to the background: Too many web authors keep uniform link colors or their pages, thereby confusing the users. What...
4
20765
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 what I am looking for is a way <behind a button click event> to dynamically change the Subform's color scheme so the listing can have color choices....
1
9556
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
4808
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 waiting-progressbar :-) Thanks Thomas
3
23172
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
19597
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. pBar1.Minimum = 1; // Set Maximum to the total number of files to copy. pBar1.Maximum = 4; //filenames.Length;
1
5401
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 (form called ProgressForm) and the built the dll. Then I reference this new assembly from within my asp.net applicaiton and tried to access...
1
4928
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 and a forest green border. However, when you move the cursor from one item to the next within the listbox or you click on an item in the listbox to...
9
33760
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 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
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8122
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.