The lag is by design when visual styles are enabled to provide a smoother animated experience to the user. This is a little documented but well-known issue. You cannot remove the lag, but you can work around it. The lag only happens when increasing the position but not when decreasing it. Call SetPos(position+1)
followed by SetPos(position)
, and the bar will jump immediately. The tricky part comes at the end. When you want to set the position to the max value, you have to first increase the max value +1, then set the desired position +1, then set the real position, then finally restore the original max value. That will allow the progressbar to fill the entire bar.
int lower, upper;
myCtrl.GetRange(lower, upper);
if (position >= upper)
{
myCtrl.SetRange(lower, upper+1);
myCtrl.SetPos(upper+1);
myCtrl.SetPos(upper);
myCtrl.SetRange(lower, upper);
}
else
{
myCtrl.SetPos(position+1);
myCtrl.SetPos(position);
}