Provides methods used to render a progress bar control with visual styles. This class cannot be inherited.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Thetype exposes the following members.
|ChunkSpaceThickness||Gets the width, in pixels, of the space between each inner piece of the progress bar.|
|ChunkThickness||Gets the width, in pixels, of a single inner piece of the progress bar.|
|IsSupported||Gets a value indicating whether the class can be used to draw a progress bar control with visual styles.|
|DrawHorizontalBar||Draws an empty progress bar control that fills in horizontally.|
|DrawHorizontalChunks||Draws a set of progress bar pieces that fill a horizontal progress bar.|
|DrawVerticalBar||Draws an empty progress bar control that fills in vertically.|
|DrawVerticalChunks||Draws a set of progress bar pieces that fill a vertical progress bar.|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
The 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.
Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 Platform Note: 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.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.