Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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:bish wakim
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Screencast - Getting to Know the Pipeline

577 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