protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (drawWithVisualStyles && ComboBoxRenderer.IsSupported)
{
// draw using the visual style renderer
ComboBoxRenderer.DrawTextBox(e.Graphics, ClientRectangle, GetTextBoxState());
ComboBoxRenderer.DrawDropDownButton(e.Graphics, dropDownButtonBounds, GetDropDownButtonState());
}
else
{
// draw using the legacy technique
Rectangle borderRect = ClientRectangle;
borderRect.Height++;
e.Graphics.FillRectangle(new SolidBrush(BackColor), ClientRectangle);
ControlPaint.DrawBorder3D(e.Graphics, borderRect);
ControlPaint.DrawComboButton(e.Graphics, dropDownButtonBounds, GetPlainButtonState());
}
OnPaintContent(new DropDownPaintEventArgs(e.Graphics, e.ClipRectangle, GetTextBoxBounds()));
}