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

building a combobox color picker

Thread ID:

Created:

Updated:

Platform:

Replies:

5459 Jul 3,2003 12:19 PM UTC Oct 26,2015 04:49 AM UTC WinForms 7
loading
Tags: Tools
Olivier Choquette
Asked On July 3, 2003 12:19 PM UTC

Hello, i want to build a color picker like the one found in the VS designer (a combobox that drops down a ColorUIControl) I tried inserting a ColorUIControl in the PopUpContainer of a ComboBoxAdv control but the drop down viewport stays the same size than when its empty. Olivier

Ramesh Praveen [Syncfusion]
Replied On July 8, 2003 12:30 PM UTC

Oliver, Attached is a sample that shows how to use a ComboDropDown and a ColorUIControl to get your desired effect. Note that you need 1.6.1 for this to work. Regards, Praveen Ramesh

tttmack
Replied On October 21, 2015 05:52 AM UTC

Hello, is there a recent example or sample code that shows how to get a colour picker from a combo box control in syncfusion WinForms?

Saravanan T [Syncfusion]
Replied On October 21, 2015 04:47 PM UTC

Hi Taylour,

Thank you for your update.

We have prepared a sample by using the ComboDropDown and ColorUIControl for your reference which can be download from the following location.

Sample Location: http://www.syncfusion.com/downloads/support/forum/5459/ze/ComboDropDown1883827079

Please refer the following code example to achieve the reported requirement.

Code Example [C#]:

//To assign the drop dropdown control

this.comboDropDown1.PopupControl = this.colorUIControl1;

//To specify the dropdown width

this.comboDropDown1.DropDownWidth = this.comboDropDown1.Width;


Screenshot:


Figure 1. ComboDropDown shows with ColorUIControl.

Regards,
Saravanan T

tttmack
Replied On October 23, 2015 03:39 AM UTC

Hi Saravanan,

Thank you very much.

I still have one problem, I would like to change the BackColor of the ComboDropDown instead of the border color as per your example.

I have noticed that when I have ComboDropDown.Style = VisualStyle.Metro or VisualStyle.Office2007, then the MetroColor and BackColor properties cannot be set and just stay the default white. Note that I can set the BackColor property when using VisualStyle.Default.

How can I change the BackColor for a ComboDropDown control when style is not VisualStyle.Default? Perhaps I can create a derived class of ComboDropDown that overrides some of its methods to do this (I did something similar with TextBoxExt in order to change its back color by overriding OnGotFocus and OnLostFocus and not calling their respective base functions), but I cant figure out how to do that with this control since overriding those methods doesn't seem to fix the problem.

Thanks for your help.
Taylour

Saravanan T [Syncfusion]
Replied On October 23, 2015 05:45 AM UTC

Hi Taylour,

Thank you for the update.

The backcolor of the ComboBoxDropDown is customized based on the Visual Style appearance. When using the Office2007, Office2010 and Metro style, the property named “UseBackColor” needs to be enabled in order to specify the required backcolor of the ComboBoxDropDown. Please refer the following code example to achieve your requirement.

Code Example [C#]:

//To specify the backcolor of the ComboDropDown

this.comboDropDown1.BackColor = this.colorUIControl1.SelectedColor;

//To set the backcolor of the text box used inside the ComboDropDown

this.comboDropDown1.TextBox.BackColor = this.colorUIControl1.SelectedColor;

//To specify whether the backcolor needs to be applied.
this.comboDropDown1.UseBackColor = true;


We have modified the sample which can be downloaded from the following location.

Sample Location: http://www.syncfusion.com/downloads/support/forum/5459/ze/ComboDropDown-1687658372

Screenshot:



Regards,
Saravanan T

tttmack
Replied On October 23, 2015 08:58 PM UTC

thank you very much for your help Saravanan!

Saravanan T [Syncfusion]
Replied On October 26, 2015 04:49 AM UTC

Hi Taylour,


Thank you for your valuable feedback.


Please let us know if you need any further assistance.


Regards,

Saravanan T


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

;