Sunday, August 5, 2012

The Case of a Strangely Coloured ProgressBar

At first this bug report puzzled me a bit. Essentially it said "Progress bar fills with blue rectangles, status text nearly impossible to read". That was a case of "works on my machine" because all I could see was that:

Can you see blue rectangles?

However, I soon discovered that just optimizing my Windows visual effects for best performance does a neat trick. If you don't know, it's under Control Panel → System → Advanced System Settings → Advanced → Performance → Settings → Visual Effects → Adjust for best performance, as in the screen shot below

Visual Effects

Here is what I saw:

Can you see blue rectangles NOW?

That was an easy fix. I just modified the ForeColor of the ProgressBar as shown below from the default value:

//before
<ProgressBar Name="Progress" Grid.Column="0" Value="{Binding ProgressValue}" HorizontalAlignment="Stretch"/>

//after
<ProgressBar Foreground="LightGreen" Name="Progress" Grid.Column="0" Value="{Binding ProgressValue}" HorizontalAlignment="Stretch"/>

Here is what I saw after making this change:

Adjusted for best performance

Allow Windows to determine settings

Reference:

WPF: Progressbar foreground colorby . Also posted on my website

No comments: