Category / Section
How to create ColorPickerComboBox in Windows Forms?
1 min read
In ComboDropdown control, it is possible to load custom control as its DropDown control.
For example:
User may like to create ColorPickerComboBox that can display ColorPickerAdv as its Dropdown control and update its selection color as its TextBox Back color.
The following code example demonstrates the same.
C#
//To assign the drop dropdown control this.comboDropDown1.PopupControl = this.colorUIControl1; //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;
VB
'To assign the drop dropdown control Me.comboDropDown1.PopupControl = Me.colorUIControl1 'To specify the backcolor of the ComboDropDown Me.comboDropDown1.BackColor = Me.colorUIControl1.SelectedColor 'To set the backcolor of the text box used inside the ComboDropDown Me.comboDropDown1.TextBox.BackColor = Me.colorUIControl1.SelectedColor 'To specify whether the backcolor needs to be applied. Me.comboDropDown1.UseBackColor = True
Figure 1. Customize the back colour of Dropdown in ComboBoxAdv with image
Sample Links:
C#: How to Customize the Back color of Dropdown in ComboBoxAdv?
VB: How to Customize the Back color of Dropdown in ComboBoxAdv?