Hello,
I am trying to use the progress bar to change colors based on a value that passes through a series of if statements. If x is below a certain value, change the color of the bar to, for example red, then if its between these two values and so on. However this is not working. I originally tried this with the standard built in progress bar and it also did not work. However, when I stepped through the code it was setting the correct color but not displaying the correct one. I did some research and found out this line Application.EnableVisualStyles() needs to be removed from the program.cs file, which I can't do per my supervisors. I am wondering if the Infragistics version is suffering from the same problem?
Here is a snippet of what I did.
Thank You
if (goal < 100) { if (goal <= (monthlyGoal *0.79)) toolbarProgress.ForeColor = System.Drawing.Color.Red; else if (goal >= (monthlyGoal * 0.80) && goal <= (monthlyGoal * 0.99)) toolbarProgress.ForeColor = System.Drawing.Color.Yellow; else if (goal >= monthlyGoal) toolbarProgress.ForeColor = System.Drawing.Color.Chartreuse; } else if (DateTime.UtcNow > monthEnd) goal = 0; else if (goal > 100) // don't let it be greater than 100 goal = 100;
Hi Sam,
Welcome to our forums!
The right way to go about setting custom background color to UltraProgressBar is through using the Appearance property and turning off the use of the operating system’s themes.
Ok, I was able to get it going. However, is it possible to make it that progress has only one solid color in it instead of two? I Have tried messing with the properties but no luck. Please advise.
Thank you
You can achieve it through setting the FillAppearance BackColor property as well.
Thank you very much for all your help. I am now all set!