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

ComboDropDown background color

Thread ID:

Created:

Updated:

Platform:

Replies:

17414 Aug 8,2004 10:28 PM UTC Aug 12,2004 06:31 PM UTC WinForms 5
loading
Tags: Tools
Lori S. Pearsall
Asked On August 8, 2004 10:28 PM UTC

I downloaded a sample from the forum to create a derived control from ComboDropDown and assign the ColorUIControl as the PopupControl. In the ColorSelected event of the ColorUIControl, the BackColor property of the ComboDropDown is changed to reflect the newly-selected color. Also, DrawListModeEditPortion is overridden and contains the following code : base.DrawListModeEditPortion(e, Color.Empty, Color.Empty, true); This works fine except that I need to set FlatStyle to System so that this combobox looks like the rest of the ones in my application. When set to System, the background color reverts to white as soon as the control loses focus. How do I override the other Draw routines that are part of the ComboDropDown so that they draw the same FlatStyle.System border but use the background color that I''ve put in BackColor?

Administrator [Syncfusion]
Replied On August 9, 2004 06:19 PM UTC

Hi Lori, I have created a test sample as per your specifications, and it seems to be working fine when the ComboDropDown''s FlatStyle is set to System. Please refer to the test sample attached here and let me know if I have understood your requirements correctly. If not, kindly modify the sample to show the problem that you are facing and send it back to us so that we could further investigate it. We appreciate your cooperation, and thanks for chosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Lori S. Pearsall
Replied On August 9, 2004 07:03 PM UTC

Hi Guru, Add this statement to your combobox initialization : this.comboDropDown1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; >Hi Lori, > >I have created a test sample as per your specifications, and it seems to be working fine when the ComboDropDown''s FlatStyle is set to System. Please refer to the test sample attached here and let me know if I have understood your requirements correctly. If not, kindly modify the sample to show the problem that you are facing and send it back to us so that we could further investigate it. We appreciate your cooperation, and thanks for chosing Syncfusion products. > >Regards, >Guru Patwal >Syncfusion, Inc.

Administrator [Syncfusion]
Replied On August 10, 2004 09:26 PM UTC

Hi Lori, Thanks for the update. I could observe this behavior here, when the ComboDropDown''s DropDownStyle is set to DropDownList. I will further investigate this issue, and get back to you as soon as possible. We appreciate your patience and cooperation. Regards, Guru Patwal Syncfusion, Inc.

Administrator [Syncfusion]
Replied On August 12, 2004 11:25 AM UTC

Hi Lori, Please derive from the ComboDropDown control and override the DrawBorderAndBackground method as shown below : public class CustomComboDropDown : ComboDropDown { SolidBrush brush = new SolidBrush(Color.White); public CustomComboDropDown() : base() { } public SolidBrush SelectedColorBrush { get { return brush; } set { brush = value; } } protected override void DrawBorderAndBackground(Graphics g, Rectangle rect) { base.DrawBorderAndBackground(g, rect); g.FillRectangle(brush,rect.X+1, rect.Y+1, rect.Width-2, rect.Height-2); } } Please refer to the sample attached here that illustrates this and let me know if it meets your requirements. Thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Lori S. Pearsall
Replied On August 12, 2004 06:31 PM UTC

Hi Guru, That''s what I was looking for - thanks!!

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

;