System.Windows.Forms.VisualStyles.VisualStyleRenderer Class

Provides methods for drawing and getting information about a System.Windows.Forms.VisualStyles.VisualStyleElement. This class cannot be inherited.

See Also: VisualStyleRenderer Members

Syntax

public sealed class VisualStyleRenderer

Remarks

The System.Windows.Forms.VisualStyles namespace exposes System.Windows.Forms.VisualStyles.VisualStyleElement objects that represent all of the controls and user interface (UI) elements that are supported by visual styles. To draw or get information about a particular element, you must set a System.Windows.Forms.VisualStyles.VisualStyleRenderer to the element you are interested in. A System.Windows.Forms.VisualStyles.VisualStyleRenderer is automatically set to a specified System.Windows.Forms.VisualStyles.VisualStyleElement in the erload:System.Windows.Forms.VisualStyles.VisualStyleRenderer.#ctor constructor, but you can also set an existing System.Windows.Forms.VisualStyles.VisualStyleRenderer to a different element by calling the erload:System.Windows.Forms.VisualStyles.VisualStyleRenderer.SetParameters method.

To draw an element, use the erload:System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawBackground method. The System.Windows.Forms.VisualStyles.VisualStyleRenderer class also includes methods, such as VisualStyleRenderer.GetColor(ColorProperty) and VisualStyleRenderer.GetEnumValue(EnumProperty), that provide information about how an element is defined by the current visual style.

The erload:System.Windows.Forms.VisualStyles.VisualStyleRenderer.#ctor constructor and many of the System.Windows.Forms.VisualStyles.VisualStyleRenderer methods throw exceptions unless visual styles are enabled in the operating system and visual styles are applied to the client area of application windows. To check for these conditions, use the static VisualStyleRenderer.IsSupported property.

The System.Windows.Forms.VisualStyles.VisualStyleRenderer class wraps the functionality of the visual styles (UxTheme) API from the Windows Shell portion of the Windows Platform SDK. For more information about visual styles, see "Using Windows XP Visual Styles" in the Platform SDK portion of the MSDN Library at tp://msdn.microsoft.com/library/.

Requirements

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