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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom paint comboboxadv and combodropdown

Thread ID:

Created:

Updated:

Platform:

Replies:

70337 Dec 7,2007 12:43 PM UTC Dec 11,2007 10:37 PM UTC WinForms 5
loading
Tags: Tools
Christian Rattat
Asked On December 7, 2007 12:43 PM UTC

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


J.Nagarajan [Syncfusion]
Replied On 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



Christian Rattat
Replied On 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


Christian Rattat
Replied On December 10, 2007 10:24 PM UTC

Hi,

any other ideas?

Thanks,
Christian


J.Nagarajan [Syncfusion]
Replied On 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



Christian Rattat
Replied On December 11, 2007 10:37 PM UTC

This was the right hint!

Thanks a lot,
Christian


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;