We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Custom paint comboboxadv and combodropdown

Hi,

I need to custom paint the dropdown button of combodropdown and comboboxadv controls. Is there any way to do that? I use SF Suite 4.2

Thanks in advance,
Christian


5 Replies

J. J.Nagarajan Syncfusion Team December 8, 2007 02:16 AM UTC

Hi Christian ,

Thanks for your interest in Syncfusion products.

If your intention is to change the DropDownButton''s color of the ComboBoxAdv control, then you have to derive ComboBoxAdv class, and you can handle Onpaint event of this control. Please refer to the following code snippet.

[C#]

public class CustomCombo : Syncfusion.Windows.Forms.Tools.ComboBoxAdv
{
public CustomCombo()
{

}
protected override void OnPaint(PaintEventArgs e)
{
Rectangle rect= (Rectangle)this.DropDownButton.Bounds;
base.OnPaint(e);
Point[] curvePoints1 = { new Point(199, 5),new Point(203, 10), new Point(207, 5) };

e.Graphics.DrawRectangle(Pens.Red, rect);
e.Graphics.FillRectangle(Brushes.Red, rect);

e.Graphics.DrawPolygon(Pens.Blue, curvePoints1);
e.Graphics.FillPolygon(Brushes.Blue, curvePoints1);

}

}


Please refer to the attached sample from the following page.

http://websamples.syncfusion.com/samples/Tools.Windows/F70337/main.htm

Let me know if you have any questions.

Regards,
Nagaraj




CR Christian Rattat December 8, 2007 05:10 AM UTC

Hi,

sure this is a solution but that would force me to replace around 500 controls in 200 existing dialogs. Is there a way to do similar without derived class?

Thanks,
Christian



CR Christian Rattat December 10, 2007 10:24 PM UTC

Hi,

any other ideas?

Thanks,
Christian



J. J.Nagarajan Syncfusion Team December 11, 2007 12:33 AM UTC

Hi Christian ,

To change the DropDownButton's color of the ComboBoxAdv control, you have to handle its Paint event. Please refer to the following code snippet.

[C#]


void comboBoxAdv1_Paint(object sender, PaintEventArgs e)
{
Graphics grph = e.Graphics;
grph.DrawRectangle(Pens.Red, (Rectangle)(this.comboBoxAdv1.DropDownButton.Bounds));
grph.FillRectangle(Brushes.Red, (Rectangle)(this.comboBoxAdv1.DropDownButton.Bounds));

Point[] curvePoints1 = { new Point(199, 5), new Point(203, 10), new Point(207, 5) };

e.Graphics.DrawPolygon(Pens.Blue, curvePoints1);
e.Graphics.FillPolygon(Brushes.Blue, curvePoints1);
}


I hope this will meet your requirement. Please let me know if you have any questions.

Thanks,
Nagaraj




CR Christian Rattat December 11, 2007 10:37 PM UTC

This was the right hint!

Thanks a lot,
Christian


Loader.
Live Chat Icon For mobile
Up arrow icon