Actually Herfried is correct FYI - Create a new class and insert the
following code *hears the appology to Herfried in the background* - I'll
leave you to fill the comments out as it's pretty self explanitory for
someone who's trying to create their own ComboBox
Brendon
<code>
/// <summary>
///
/// </summary>
public class cboButton : Button
{
#region Fields
private ButtonState buttonState;
private ComboBoxState comboBoxState;
#endregion
#region Constructor
/// <summary>
/// Custom
/// </summary>
public cboButton()
{
SetControlStyles();
}
#endregion
#region Protected override methods
/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnMouseUp(MouseEventArgs e)
{
buttonState = ButtonState.Normal;
comboBoxState = ComboBoxState.Normal;
base.OnMouseUp(e);
}
/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnMouseDown(MouseEventArgs e)
{
buttonState = ButtonState.Pushed;
comboBoxState = ComboBoxState.Pressed;
base.OnMouseDown(e);
}
/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (!ComboBoxRenderer.IsSupported)
{
ControlPaint.DrawComboButton(e.Graphics,
this.ClientRectangle, buttonState);
}
else
{
ComboBoxRenderer.DrawDropDownButton(e.Graphics,
this.ClientRectangle, comboBoxState);
}
}
#endregion
#region Private methods
/// <summary>
///
/// </summary>
private void SetControlStyles()
{
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
}
#endregion
/// <summary>
///
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// cboButton
//
this.UseCompatibleTextRendering = true;
this.ResumeLayout(false);
}
}
</code>