This documentation is archived and is not being maintained.

How to: Use a Control Rendering Class 

This example demonstrates how to use the ComboBoxRenderer class to render the drop-down arrow of a combo box control. The example consists of the OnPaint method of a simple custom control. The System.Windows.Forms.ComboBoxRenderer.IsSupported property is used to determine whether visual styles are enabled in the client area of application windows. If visual styles are active, then the System.Windows.Forms.ComboBoxRenderer.DrawDropDownButton(System.Drawing.Graphics,System.Drawing.Rectangle,System.Windows.Forms.VisualStyles.ComboBoxState) method will render the drop-down arrow with visual styles; otherwise, the System.Windows.Forms.ControlPaint.DrawComboButton method will render the drop-down arrow in the classic Windows style.


// Render the drop-down arrow with or without visual styles.
protected override void OnPaint(PaintEventArgs e)

    if (!ComboBoxRenderer.IsSupported)
            this.ClientRectangle, ButtonState.Normal);
            this.ClientRectangle, ComboBoxState.Normal);

Compiling the Code

This example requires:

See Also