System.Windows.Forms.ComboBoxRenderer Class

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

See Also: ComboBoxRenderer Members


public sealed class ComboBoxRenderer


The System.Windows.Forms.ComboBoxRenderer class provides a set of static methods that can be used to render a combo box 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 combo box, use the erload:System.Windows.Forms.ComboBoxRenderer.DrawTextBox method to draw the text box and the ComboBoxRenderer.DrawDropDownButton(System.Drawing.Graphics, System.Drawing.Rectangle, System.Windows.Forms.VisualStyles.ComboBoxState) method to draw the drop-down arrow.

If visual styles are enabled in the operating system and visual styles are applied to the client area of application windows, erload:System.Windows.Forms.ComboBoxRenderer.DrawTextBox and ComboBoxRenderer.DrawDropDownButton(System.Drawing.Graphics, System.Drawing.Rectangle, System.Windows.Forms.VisualStyles.ComboBoxState) will draw the combo box with the current visual style. Otherwise, these methods will throw an InvalidOperationException. To determine whether the members of this class can be used, you can check the value of the ComboBoxRenderer.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.ComboBox.DropDownButton and System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox.TextEdit classes. For more information, see Rendering Controls with Visual Styles.


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