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 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 ComboBoxRenderer.DrawDropDownButton method will render the drop-down arrow with visual styles; otherwise, the 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);

This example requires:

Community Additions