I have this code:
for(int k = 0; k<11; k++)
{
pBar.Maximum = 10;
pBar.Value = k;
if (pBar.Maximum == k)
pBar.Value = 0;
}
If you switch to Classic mode, this glitch will be gone. The progress bar will appear fully drawn before being reset.
This is because in Classic mode, the painting operation is synchronous and completes before the Value
setter returns, but in the themed mode, there is some sort of animation played when you increase the value, and that takes some time to play.
On contrary, when you decrease the value, there is no animation; the progress bar is shrinked immediately.
This is why it appears only about 60% full: you decrease the value (which completes immediately) before the progress bar has time to draw the animation for the last several increments.