See Also: ProgressBar Members
A System.Windows.Forms.ProgressBar control visually indicates the progress of a lengthy operation in one of three styles:
Segmented blocks that increase in steps from left to right.
A continuous bar that fills in from left to right.
A block that scrolls across a System.Windows.Forms.ProgressBar in a marquee fashion.
The ProgressBar.Style property determines the style of System.Windows.Forms.ProgressBar that is displayed. Note that the System.Windows.Forms.ProgressBar control can only be oriented horizontally. For an example of how to create a vertically oriented System.Windows.Forms.ProgressBar, see the System.Windows.Forms.ProgressBarRenderer class. The System.Windows.Forms.ProgressBar control is typically used when an application performs tasks such as copying files or printing documents. Users of an application might consider an application unresponsive if there is no visual cue. By using the System.Windows.Forms.ProgressBar in your application, you alert the user that the application is performing a lengthy task and that the application is still responding.
The ProgressBar.Maximum and ProgressBar.Minimum properties define the range of values to represent the progress of a task. The ProgressBar.Minimum property is typically set to a value of 0, and the ProgressBar.Maximum property is typically set to a value indicating the completion of a task. For example, to properly display the progress when copying a group of files, the ProgressBar.Maximum property could be set to the total number of files to be copied.
The ProgressBar.Value property represents the progress that the application has made toward completing the operation. The value displayed by the System.Windows.Forms.ProgressBar only approximates the current value of the ProgressBar.Value property. Based on the size of the System.Windows.Forms.ProgressBar, the ProgressBar.Value property determines when to display the next block or increase the size of the bar.
There are a number of ways to modify the value displayed by the System.Windows.Forms.ProgressBar other than changing the ProgressBar.Value property directly. You can use the ProgressBar.Step property to specify a specific value to increment the ProgressBar.Value property by, and then call the ProgressBar.PerformStep method to increment the value. To vary the increment value, you can use the ProgressBar.Increment(int) method and specify a value with which to increment the ProgressBar.Value property.
Control.ForeColor and Control.BackColor changes for the System.Windows.Forms.ProgressBar will not be honored when visual styles are enabled on winxpfamily and above.