ProgressBarRenderer Class


Provides methods used to render a progress bar control with visual styles. This class cannot be inherited.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)


type ProgressBarRenderer = class end


Gets the width, in pixels, of the space between each inner piece of the progress bar.


Gets the width, in pixels, of a single inner piece of the progress bar.


Gets a value indicating whether the ProgressBarRenderer class can be used to draw a progress bar control with visual styles.

System_CAPS_pubmethodSystem_CAPS_staticDrawHorizontalBar(Graphics, Rectangle)

Draws an empty progress bar control that fills in horizontally.

System_CAPS_pubmethodSystem_CAPS_staticDrawHorizontalChunks(Graphics, Rectangle)

Draws a set of progress bar pieces that fill a horizontal progress bar.

System_CAPS_pubmethodSystem_CAPS_staticDrawVerticalBar(Graphics, Rectangle)

Draws an empty progress bar control that fills in vertically.

System_CAPS_pubmethodSystem_CAPS_staticDrawVerticalChunks(Graphics, Rectangle)

Draws a set of progress bar pieces that fill a vertical progress bar.


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)


Returns a string that represents the current object.(Inherited from Object.)

The ProgressBarRenderer class provides a set of static methods that can be used to render a progress bar control with the current visual style of the operating system. Rendering a control refers to drawing the user interface of a control. This is useful if you are drawing a custom control that should have the appearance of the current visual style. To draw a progress bar, use the DrawHorizontalBar or DrawVerticalBar methods to draw the empty bar, and then use the DrawHorizontalChunks or DrawVerticalChunks methods to draw the elements that fill in the bar.

If visual styles are enabled in the operating system and visual styles are applied to the client area of application windows, the methods of this class will draw the progress bar with the current visual style. Otherwise, the methods and properties of this class will throw an InvalidOperationException. To determine whether the members of this class can be used, you can check the value of the IsSupported property.

This class wraps the functionality of a System.Windows.Forms.VisualStyles.VisualStyleRenderer that is set to one of the elements exposed by the System.Windows.Forms.VisualStyles.VisualStyleElement.ProgressBar.Bar, System.Windows.Forms.VisualStyles.VisualStyleElement.ProgressBar.BarVertical, System.Windows.Forms.VisualStyles.VisualStyleElement.ProgressBar.Chunk, and System.Windows.Forms.VisualStyles.VisualStyleElement.ProgressBar.ChunkVertical classes. For more information, see Rendering Controls with Visual Styles.


Visual styles are supported only on these platforms.

The following code example demonstrates how to create a custom control that uses the DrawVerticalBar and DrawVerticalChunks methods to draw a vertical progress bar. The control uses a Timer to redraw the progress bar with an added piece each second. The SetupProgressBar method uses the ChunkThickness and ChunkSpaceThickness properties to calculate the height of each progressively larger rectangle that is drawn.

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

.NET Framework
Available since 2.0

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

Return to top