How to change gradually  by code the forecolor of a Progressbar ?ex:from green to yellow

Posted on 2010-01-11
Medium Priority
Last Modified: 2013-11-12
I would like my Progressbar forecolor to change gradually from color1 to color2 when its value change from minimum to maximum. (by code c#)

Thans in advance
Question by:fara2000
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 11

Accepted Solution

lenordiste earned 1000 total points
ID: 26284944
here is some theorics for the easiest method  (and it works i tried it):

 //Here are your colors, params are Red, Green, Blue
Color green = Color.FromArgb(0, 255, 0);
Color yellow = Color.FromArgb(255, 255, 0);

all you need to do to go from green to yellow is to increment the red component. You can do so in a loop, add 1 everytime to a value X going from 0 to 255:
for(int R=0;R<=255;R++){
     Color myColor = Color.FromArgb(R,255,0);

thus you need to watch your progress on a scale of 255 possible values.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question