Evening,
I have a slight erk with the ComboBoxRenderer running under Vista and was
hoping someone could shed some light on this for me.
I've created a custom control that inherits from Button - no problems there
:)
The problem comes with the actual painting of the custom button... The Visa
one blends in almost perfectly with the textbox component of a combo - BUT a
custom painted one shows up as ugly and grey; both in design and run time...
Can anyone explain why or let me know if I am missing something that is
Vista specific?
As I don't have another Vista machine to test this on and don't know another
developer who has Vista I'm stumped...
<code>
#region Fields
private ButtonState buttonState;
private ComboBoxState comboBoxState;
#endregion
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);
}
}
</code>
I do also SetStyle on the control during initialisation
<code>
private void SetControlStyles()
{
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
}
</code>
Thanks
Brendon