The System.Windows.Forms.VisualStyles namespace exposes 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 VisualStyleRenderer to the element you are interested in. A VisualStyleRenderer is automatically set to a specified VisualStyleElement in the VisualStyleRenderer constructor, but you can also set an existing VisualStyleRenderer to a different element by calling the SetParameters method.

To draw an element, use the DrawBackground method. The VisualStyleRenderer class also includes methods, such as GetColor and GetEnumValue, that provide information about how an element is defined by the current visual style.

The VisualStyleRenderer constructor and many of the 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 staticIsSupported property.

The 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 http://msdn.microsoft.com/library.