Loading...
Loading...
Implement and customize the Syncfusion Windows Forms ColorPickerButton control for color selection. Trigger when user needs a color picker dropdown, color selection UI, color input control, or needs to let users select from color groups (standard, system, custom, user colors). Covers getting started, color selection, customization, and UI appearance properties.
npx skill4agent add syncfusion/winforms-ui-components-skills syncfusion-winforms-color-picker-dropdownusing Syncfusion.Windows.Forms;
public class ColorPickerForm : Form
{
public ColorPickerForm()
{
// Create ColorPickerButton instance
var colorPicker = new ColorPickerButton();
colorPicker.Text = "Select a Color";
colorPicker.Location = new System.Drawing.Point(10, 10);
colorPicker.Size = new System.Drawing.Size(150, 30);
// Set initial selected color and group
colorPicker.SelectedColor = System.Drawing.Color.Red;
colorPicker.SelectedColorGroup = Syncfusion.Windows.Forms.ColorUISelectedGroup.StandardColors;
// Add to form
this.Controls.Add(colorPicker);
// Set initial form properties
this.Text = "ColorPickerButton Demo";
this.Size = new System.Drawing.Size(400, 300);
}
}colorPickerButton1.SelectedAsBackcolor = true;
colorPickerButton1.SelectedColor = System.Drawing.Color.OrangeRed;
// Button background now shows the selected colorcolorPickerButton1.SelectedAsText = true;
colorPickerButton1.SelectedColor = System.Drawing.Color.Blue;
// Button text displays the selected color name/valuecolorPickerButton1.SelectedColorGroup = Syncfusion.Windows.Forms.ColorUISelectedGroup.StandardColors;
colorPickerButton1.SelectedColor = System.Drawing.Color.Green;
// Focus the Standard Colors group when dropdown openscolorPickerButton1.ColorUISize = new System.Drawing.Size(250, 280);
// Adjust dropdown dimensions for your layout| Property | Type | Purpose |
|---|---|---|
| System.Drawing.Color | Gets/sets the currently selected color |
| ColorUISelectedGroup | Sets which color group tab is focused (StandardColors, SystemColors, CustomColors, UserColors, None) |
| bool | When true, button background displays the selected color |
| bool | When true, button text displays the selected color value |
| System.Drawing.Size | Gets/sets the size of the dropdown ColorUIControl |
| string | Gets/sets the button text |
// Let users pick a theme color that shows on the button
colorPickerButton.SelectedAsBackcolor = true;
colorPickerButton.SelectedColorGroup = ColorUISelectedGroup.StandardColors;// Show selected color value and group
colorPickerButton.SelectedAsText = true;
colorPickerButton.SelectedColorGroup = ColorUISelectedGroup.CustomColors;// Minimize space with compact size
colorPickerButton.ColorUISize = new System.Drawing.Size(200, 200);
colorPickerButton.Size = new System.Drawing.Size(80, 25);