ComboBoxRenderer Class

 

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

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

System.Object
  System.Windows.Forms.ComboBoxRenderer

[<Sealed>]
type ComboBoxRenderer = class end

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticIsSupported

Gets a value indicating whether the ComboBoxRenderer class can be used to draw a combo box with visual styles.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticDrawDropDownButton(Graphics, Rectangle, ComboBoxState)

Draws a drop-down arrow with the current visual style of the operating system.

System_CAPS_pubmethodSystem_CAPS_staticDrawTextBox(Graphics, Rectangle, ComboBoxState)

Draws a text box in the specified state and bounds.

System_CAPS_pubmethodSystem_CAPS_staticDrawTextBox(Graphics, Rectangle, String, Font, ComboBoxState)

Draws a text box in the specified state and bounds, with the specified text.

System_CAPS_pubmethodSystem_CAPS_staticDrawTextBox(Graphics, Rectangle, String, Font, Rectangle, ComboBoxState)

Draws a text box in the specified state and bounds, with the specified text and text bounds.

System_CAPS_pubmethodSystem_CAPS_staticDrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, ComboBoxState)

Draws a text box in the specified state and bounds, with the specified text, text formatting, and text bounds.

System_CAPS_pubmethodSystem_CAPS_staticDrawTextBox(Graphics, Rectangle, String, Font, TextFormatFlags, ComboBoxState)

Draws a text box in the specified state and bounds, with the specified text and text formatting.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

The 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 DrawTextBox method to draw the text box and the DrawDropDownButton 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, DrawTextBox and DrawDropDownButton 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 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.

WinXpFamily

Visual styles are supported only on these platforms.

The following code example demonstrates how to create a custom control that uses the DrawTextBox and DrawDropDownButton methods to draw a combo box that responds to mouse clicks.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: