ComboBoxRenderer not painting correct on Vista

  • Thread starter Brendon Bezuidenhout
  • Start date
B

Brendon Bezuidenhout

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
 
B

Brendon Bezuidenhout

Never mind - I found the problem; it appears the Shell Programmers shafted
the ComboBox AGAIN with an upgrade to the OS and development environment
*cry*

So I need to handle the DrawThemeBackground API to render the vista themes
including the Aero visual style -.-

Any MVP's able to give more of a heads up as when/if this will ever get
fixed?

Brendon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top