Siticone Color Picker Button
The SiticoneColorPickerButton acts as both a trigger and a preview for color selection.
Clicking it opens a standard color dialog (or triggers a custom event), and the button's appearance automatically updates to reflect the chosen color.
Color Selection
The core functionality revolves around managing the selected color.
| Property | Type | Description |
|---|---|---|
SelectedColor |
Color | The currently selected color. Setting this property updates the button's appearance (Fill or Border) depending on the style. |
DefaultColor |
Color | The fallback color used when resetting or initializing the control. |
AllowOpacity |
bool | If true, allows picking colors with alpha transparency (if supported by the dialog). |
Visual Style
Customize how the selected color is displayed on the button.
| Property | Type | Description |
|---|---|---|
ColorPreviewMode |
Enum |
|
ShowColorText |
bool | If true, displays the color's Hex or RGB value as text on the button. |
ColorTextFormat |
string | Format string for color text (e.g., "Hex", "RGB", "Name"). |
Events
Events specific to color selection.
// Fired when a new color is confirmed.
colorBtn.ColorSelected += (s, e) =>
{
Console.WriteLine($"Color Picked: {e.HexValue}");
// Apply to target control
panel1.BackColor = e.SelectedColor;
};
Designer Support
The control includes a Smart Tag menu for quick configuration.
| Category | Features |
|---|---|
Quick Colors |
One-click presets for common colors (Red, Green, Blue, etc.). |
Settings |
Copy/Paste visual settings between multiple buttons. |
Usage Examples
Example 1: Theme Color Picker
A button that lets users pick an accent color for the application.
private void SetupAccentPicker()
{
btnAccent.SelectedColor = Properties.Settings.Default.AccentColor;
btnAccent.ColorPreviewMode = ColorPreviewMode.Background;
// Show the Hex code
btnAccent.ShowColorText = true;
btnAccent.ColorTextFormat = "Hex"; // e.g., "#FF5733"
btnAccent.ColorSelected += (s, e) =>
{
UpdateAppTheme(e.SelectedColor);
};
}
Example 2: Text Color Tool
A toolbar button for changing text color in a rich text editor.
private void SetupTextTool()
{
btnTextColor.SelectedColor = Color.Black;
btnTextColor.ColorPreviewMode = ColorPreviewMode.Icon; // Only color the 'A' icon
btnTextColor.Image = Properties.Resources.icon_font;
btnTextColor.ColorSelected += (s, e) =>
{
richTextBox1.SelectionColor = e.SelectedColor;
};
}