I don't know how long an action could take and I want to display a progress bar to the user in a dialog box. I've tried using System.Windows.Forms.ProgressBar but it doesn't seem to support it.
An example of what I'd want is the progress bar that windows shows you when it's looking for new drivers on the internet. It's just got three or four 'bars' going back and forth marquee style on the progress bar.
How can I do this?
To create a ProgressBar control at design-time, you simply drag a ProgressBar control from the Toolbox and drop onto a Form in Visual Studio. After you the drag and drop, a ProgressBar is created on the Form; for example the ProgressBar1 is added to the form and looks as in Figure 1.
Property Value The amount by which to increment the progress bar with each call to the PerformStep() method. The default is 10.
The ProgressBar provides options for setting its value or a range of values and for indicating the progress of an ongoing task. To set the value of the ProgressBar, use its value option. To define the start and end values of the range, use the min and max ProgressBar settings respectively.
System.Windows.Forms.ProgressBar has a property called Style
. Setting Style
to Marquee
will achieve the effect your looking for.
EDIT: Divo points out the Marquee Style is only available on
Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003
The comments provide even more information indicating that this appears to work everywhere as long as you're using .NET 2.0 or higher.
Have you tried setting the Style
property of the System.Windows.Forms.ProgressBar
to Marquee
?
However, surprisingly, this property is only available on the following platforms (according to MSDN):
Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003
Might be that the documentation has not been updated to Vista though. Anyone knows about a limitation on Vista?
EDIT: As posted in another comment the documentation seems to be wrong with respect to the supported platforms. Should be working on Vista as well as Windows 7.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With