Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
UltraProgressBar Backcolor Not Working
posted

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;