See Also: VisualStyleElement Members
The System.Windows.Forms.VisualStyles.VisualStyleElement class identifies a Windows control or user interface (UI) element that is defined by the current visual style of the operating system. A visual style element is defined in terms of class, part, and state:
The class identifies a group of related visual style elements that are typically drawn together. The class is specified by the VisualStyleElement.ClassName property.
The part defines a discrete member of a class. The part is specified by the VisualStyleElement.Part property.
The state describes the current visual state of the element defined by the class and part. The state is specified by the VisualStyleElement.State property.
The System.Windows.Forms.VisualStyles namespace exposes hundreds of System.Windows.Forms.VisualStyles.VisualStyleElement objects that represent the controls and user interface elements that can be defined by a visual style. These objects are exposed as static properties of nested classes of System.Windows.Forms.VisualStyles.VisualStyleElement. For each property, the qualified name of the owning class represents the class and the part of the drawn element, and the property name represents the state of the element. For example, the System.Windows.Forms.VisualStyles.VisualStyleElement.Button.PushButton.Pressed property returns a System.Windows.Forms.VisualStyles.VisualStyleElement that can be used to draw a button in the pressed state with visual styles. The Pressed property name corresponds to the state, PushButton corresponds to the part, and Button identifies the class of the visual style element.
To draw a visual style element, create a System.Windows.Forms.VisualStyles.VisualStyleRenderer, set it to the System.Windows.Forms.VisualStyles.VisualStyleElement you wish to draw, and then call the erload:System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawBackground method. To determine whether the current visual style provides a definition for a particular element, call the VisualStyleRenderer.IsElementDefined(VisualStyleElement) method with the element as the argument.
System.Windows.Forms.VisualStyles.VisualStyleElement and System.Windows.Forms.VisualStyles.VisualStyleRenderer wrap the functionality of the visual styles API from the Windows Shell portion of the Windows Platform SDK. For more information on visual styles, see "Using Windows XP Visual Styles" in the Platform SDK portion of the MSDN Library at tp://msdn.microsoft.com/library/.