C# Progressbar is not updated accurately in Vista or Windows7

Posted by Samir on Stack Overflow See other posts from Stack Overflow or by Samir
Published on 2010-04-06T06:31:23Z Indexed on 2010/04/06 6:33 UTC
Read the original article Hit count: 447

Filed under:
|
|
private void timer1_Tick(object sender, EventArgs e)
{
   if (this.progressBar1.Value >= 100)
   {
       this.timer1.Stop();
       this.timer1.Enabled = false;
   }
   else
   {
       this.progressBar1.Value += 10;
       this.label1.Text = Convert.ToString(this.progressBar1.Value);                
   }
}

Here I used a timer to update the progress bar value. It works fine in XP. But in Windows7 or Vista when the progress value is set to say 100 but the graphical progress is not 100!

Searching some threads found that its for animation lag in Vista/Windows7.

How to get rid of this thing?

I don't want to loose the look and feel of Vista/Window7 using:

SetWindowTheme(progressBar1.Handle, " ", " ");

© Stack Overflow or respective owner

Related posts about c#

Related posts about progressbar