Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ToolStripProgressBar Class

Represents a Windows progress bar control contained in a StatusStrip.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public ref class ToolStripProgressBar : public ToolStripControlHost
public class ToolStripProgressBar extends ToolStripControlHost
public class ToolStripProgressBar extends ToolStripControlHost
Not applicable.

ToolStripProgressBar is the ProgressBar optimized for hosting in a ToolStrip. A subset of the hosted control's properties and events are exposed at the ToolStripProgressBar level, but the underlying ProgressBar control is fully accessible through the ProgressBar property.

A ToolStripProgressBar control visually indicates the progress of a lengthy operation. The ToolStripProgressBar control displays a bar that fills in from left to right with the system highlight color as an operation progresses.

NoteNote:

The ToolStripProgressBar control can only be oriented horizontally.

The ToolStripProgressBar 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. Use the ToolStripProgressBar to notify the user that the application is performing a lengthy task and that the application is still responding.

The Maximum and Minimum properties define the range of values to represent the progress of a task. The Minimum property is typically set to a value of zero, and the Maximum property is typically set to a value indicating the completion of a task. For example, to display the progress properly when copying a group of files, the Maximum property could be set to the total number of files to be copied. The Value property represents the progress that the application has made toward completing the operation. Because the bar displayed in the control is a collection of blocks, the value displayed by the ToolStripProgressBar only approximates the Value property's current value. Based on the size of the ToolStripProgressBar, the Value property determines when to display the next block.

There are a number of ways to modify the value displayed by the ToolStripProgressBar other than changing the Value property directly. You can use the Step property to specify a specific value to increment the Value property by, and then call the PerformStep method to increment the value. To vary the increment value, you can use the Increment method and specify a value by which to increment the Value property.

ToolStripProgressBar replaces the older ProgressBar control, which is nevertheless retained for backward compatibility.

The following code example demonstrates a ToolStripProgressBar that calculates a sequence of Fibonacci numbers.

No code example is currently available or this language may not be supported.

System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.ToolStripItem
         System.Windows.Forms.ToolStripControlHost
          System.Windows.Forms.ToolStripProgressBar

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft