System.Windows.Forms.ProgressBarRenderer Class

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

See Also: ProgressBarRenderer Members

Syntax

public sealed class ProgressBarRenderer

Remarks

The System.Windows.Forms.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 ProgressBarRenderer.DrawHorizontalBar(System.Drawing.Graphics, System.Drawing.Rectangle) or ProgressBarRenderer.DrawVerticalBar(System.Drawing.Graphics, System.Drawing.Rectangle) methods to draw the empty bar, and then use the ProgressBarRenderer.DrawHorizontalChunks(System.Drawing.Graphics, System.Drawing.Rectangle) or ProgressBarRenderer.DrawVerticalChunks(System.Drawing.Graphics, System.Drawing.Rectangle) 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 ProgressBarRenderer.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.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0