For some operations such as logging on to a web site or downloading a web page, you may not know how long it will take the operation to finish.  So instead of showing a progress bar with a specified percent complete, you can set the .NET ProgressBar to cycle continuously.


To make a ProgressBar cycle continuously, set the MarqueeAnimationSpeed property to a positive value (by default, it is set to 0).  The value specifies the time period, in milliseconds, that it takes the progress block to scroll across the progress bar.  A higher value results in a slower speed, and a lower value results in a faster speed.  I’ve found that a value of 30 works pretty well.  It’s also important to set the Style property to ProgressBarStyle.Marquee.

this.ProgressBar_Download.MarqueeAnimationSpeed = 30;
this.ProgressBar_Download.Style = ProgressBarStyle.Marquee;

To stop the cycle, set the MarqueeAnimationSpeed property to 0.  To resume the cycle, set it to a positive value.

Share and Enjoy:
  • Digg
  • Twitter
  • Facebook
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Google Bookmarks
  • Slashdot