Class ColorUIControl
Represents a standard interface for selecting colors.
Inherited Members
Namespace: Syncfusion.Windows.Forms
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class ColorUIControl : BaseControl, IThemeProvider, IVisualStyle, IDisposable
Remarks
The ColorUIControl implements a palette type visual interface for selecting colors at run-time similar to the color picker drop-down provided by the Visual Studio.NET environment. The ColorUIControl class offers a selection of colors divided into three color groupings arranged as tabs. The three color groupings are the SystemColors consisting of the colors defined within the System.Drawing.SystemColors class, the StandardColors consisting of the colors defined within System.Drawing.Color and a CustomColors providing a customizable color palette. The ColorUIControl control can be used either as a regular control hosted within a parent container or it can be used as a drop-down control in combination with the ColorPickerButton control.
Examples
The following code creates a ColorUIControl, sets the color groups and adds an event handler for the ColorUIControl.ColorSelected event:
private void InitializeColorUIControl()
{
// Create the ColorUIControl.
Syncfusion.Windows.Forms.ColorUIControl clrUIControl = new Syncfusion.Windows.Forms.ColorUIControl(); // Set the ColorGroups to be displayed
clrUIControl.ColorGroups = ( Syncfusion.Windows.Forms.ColorUIGroups.CustomColors|
Syncfusion.Windows.Forms.ColorUIGroups.StandardColors|
Syncfusion.Windows.Forms.ColorUIGroups.SystemColors );
// Set the initially selected group and color.
clrUIControl.SelectedColorGroup = Syncfusion.Windows.Forms.ColorUISelectedGroup.SystemColors;
clrUIControl.SelectedColor = SystemColors.ControlDark;
// Provide a handler for the ColorUIControl.ColorSelected event.
clrUIControl.ColorSelected += new EventHandler(this.OnColorSelected);
}
// Handler for the ColorUIControl.ColorSelected event.
private void OnColorSelected(object sender, System.EventArgs e)
{
Color clrselected = (sender as ColorUIControl).SelectedColor;
}</code></pre></coderef>
Private Sub InitializeColorUIControl() ' Create an instance of the ColorUIControl.
Me.clrUIControl = New Syncfusion.Windows.Forms.ColorUIControl()
' Set the color groups to be shown.
Me.clrUIControl.ColorGroups = Syncfusion.Windows.Forms.ColorUIGroups.CustomColors Or Syncfusion.Windows.Forms.ColorUIGroups.StandardColors
' Set the initially selected group.
Me.clrUIControl.SelectedColorGroup = Syncfusion.Windows.Forms.ColorUISelectedGroup.CustomColors
' Subscribe to the ColorUIControl.ColorSelected event.
AddHandler Me.clrUIControl.ColorSelected, New System.EventHandler(AddressOf clrUIControl_ColorSelected)
End Sub
' Handler for the ColorUIControl.ColorSelected event.
Private Sub clrUIControl_ColorSelected(ByVal sender As Object, ByVal e As System.EventArgs)
Dim clrselected As Color = Me.clrUIControl.SelectedColor
End Sub 'clrUIControl_ColorSelected</code></pre></coderef>
Constructors
ColorUIControl()
Initialize a new instance of the ColorUIControl class.
Declaration
public ColorUIControl()
Properties
BeforeTouchSize
Gets or sets Control size before touch enabled.
Declaration
public Size BeforeTouchSize { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Size |
BorderStyle
Gets or sets the border style of the control.
Declaration
public BorderStyle BorderStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Windows.Forms.BorderStyle | A System.Windows.Forms.BorderStyle value. The default is BorderStyle.Fixed3D. |
ColorGroups
Gets or sets the color tabpages to be displayed by the control.
Declaration
public ColorUIGroups ColorGroups { get; set; }
Property Value
| Type | Description |
|---|---|
| ColorUIGroups | A ColorUIGroups value. The default is ColorUIGroups.All. |
CreateParams
Overridden. See System.Windows.Forms.Control.CreateParams.
Declaration
protected override CreateParams CreateParams { get; }
Property Value
| Type |
|---|
| System.Windows.Forms.CreateParams |
CustomColorsStretchOnResize
Gets or sets enable stretch custom colors panel on resize.
Declaration
public bool CustomColorsStretchOnResize { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
CustomTabName
Gets or sets the text displayed on the custom colors tab.
Declaration
public string CustomTabName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | A String value. |
EnableTouchMode
Gets or sets value to enable or disable the Touchmode to the controls.
Declaration
public bool EnableTouchMode { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Remarks
Scale factor will be updated automatically if scalefactor is equal to 1
Flag
Gets or sets a flag value.
Declaration
public bool Flag { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Font
Overrides the Font property.
Declaration
public override Font Font { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Font |
MetroColor
Gets or sets the theme color of the ColorUI.
Declaration
public Color MetroColor { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Color |
MetroForeColor
Gets or sets the theme forecolor of the ColorUI.
Declaration
public Color MetroForeColor { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Color |
ScrollMetroColorTable
Gets or sets custom color to scroller.
Declaration
public MetroColorTable ScrollMetroColorTable { get; set; }
Property Value
| Type |
|---|
| MetroColorTable |
SelectedColor
Gets or sets the current selected color.
Declaration
public Color SelectedColor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Color | A System.Drawing.Color value. |
SelectedColorGroup
Gets or sets the tab associated with this color group the selected tab.
Declaration
public ColorUISelectedGroup SelectedColorGroup { get; set; }
Property Value
| Type | Description |
|---|---|
| ColorUISelectedGroup | A ColorUISelectedGroup value. |
ShowUserSelectionColors
Gets or sets a value to show or hide the user selection color swatches.
Declaration
public bool ShowUserSelectionColors { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
StandardTabName
Gets or sets the text displayed on the standard colors tab.
Declaration
public string StandardTabName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | A String value. |
SystemTabName
Gets or sets the text displayed on the system colors tab.
Declaration
public string SystemTabName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | A String value. |
ThemeStyle
Gets or sets the
Declaration
public ColorUIControlVisualStyle ThemeStyle { get; set; }
Property Value
| Type |
|---|
| ColorUIControlVisualStyle |
Remarks
This ThemeStyle settings will be applied only when the VisualStyleBased theme has been applied to the control.
UserColors
Gets user colors.
Declaration
public ColorUIControl.ColorCollection UserColors { get; }
Property Value
| Type |
|---|
| ColorUIControl.ColorCollection |
Remarks
ColorGroups must be UserColors for use this property.
UserColorsStretchOnResize
Gets or sets enable stretch user colors panel on resize.
Declaration
public bool UserColorsStretchOnResize { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
UserCustomColors
Gets user custom colors.
Declaration
public ColorUIControl.ColorCollection UserCustomColors { get; }
Property Value
| Type |
|---|
| ColorUIControl.ColorCollection |
Remarks
ColorGroups must be UserColors for use this property.
UserTabName
Gets or sets the text displayed on the user colors tab.
Declaration
public string UserTabName { get; set; }
Property Value
| Type |
|---|
| System.String |
VisualStyle
Gets or sets an advanced appearance for the ColorUI.
Declaration
public ColorUIStyle VisualStyle { get; set; }
Property Value
| Type |
|---|
| ColorUIStyle |
Methods
ApplyScaleToControl(Single)
Scale the control based on the scale factor passed in the argument.
Declaration
public void ApplyScaleToControl(float scaleFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | scaleFactor | value to scale the factor based upon. |
CreateAccessibilityInstance()
Creates a new accessibility object in ColorUIControl.
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
| Type | Description |
|---|---|
| System.Windows.Forms.AccessibleObject | Returns a new System.Windows.Forms.AccessibleObject for the ColorUIControl |
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
End()
Ends the color display drop-down.
Declaration
public void End()
GetControlName(String)
Helps to apply the ControlName settings in control
Declaration
public override string GetControlName(string controlName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | controlName | ControlName |
Returns
| Type |
|---|
| System.String |
Overrides
OnColorSelected(EventArgs)
Raises the ColorSelected event.
Declaration
protected virtual void OnColorSelected(EventArgs arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | arg | A System.EventArgs value that contains the event data. |
OnFontChanged(EventArgs)
Overridden. See System.Windows.Forms.Control.OnFontChanged.
Declaration
protected override void OnFontChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnGotFocus(EventArgs)
Overridden. See System.Windows.Forms.Control.OnGotFocus.
Declaration
protected override void OnGotFocus(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnPaint(PaintEventArgs)
Declaration
protected override void OnPaint(PaintEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.PaintEventArgs | e |
OnSizeChanged(EventArgs)
Declaration
protected override void OnSizeChanged(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnThemeNameChanged(String)
Declaration
public override void OnThemeNameChanged(string themeName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | themeName |
Overrides
PaintValue(PaintValueEventArgs)
Paints a representative value of the given object to the provided canvas.
Declaration
public virtual void PaintValue(PaintValueEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Design.PaintValueEventArgs | e | The System.Drawing.Design.PaintValueEventArgs instance containing the event data. |
PaintValue(Object, Graphics, Rectangle)
Paints a representative value of the given object to the provided canvas.
Declaration
public void PaintValue(object value, Graphics canvas, Rectangle rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | value | The value to paint. |
| System.Drawing.Graphics | canvas | Gets the System.Drawing.Graphics object with which painting should be done. |
| System.Drawing.Rectangle | rectangle | Gets the rectangle that indicates the area in which the painting should be done. |
ProcessDialogKey(Keys)
Overridden. See System.Windows.Forms.Control.ProcessDialogKey.
Declaration
protected override bool ProcessDialogKey(Keys keyData)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Keys | keyData |
Returns
| Type |
|---|
| System.Boolean |
ResetCustomTabName()
Resets the CustomTabName property to its default value.
Declaration
public virtual void ResetCustomTabName()
ResetSelectedColor()
Resets the SelectedColor property to its default value.
Declaration
public virtual void ResetSelectedColor()
ResetSelectedColorGroup()
Resets the SelectedColorGroup property to its default value.
Declaration
public virtual void ResetSelectedColorGroup()
ResetStandardTabName()
Resets the StandardTabName property to its default value.
Declaration
public virtual void ResetStandardTabName()
ResetSystemTabName()
Resets the SystemTabName property to its default value.
Declaration
public virtual void ResetSystemTabName()
ShouldSerializeCustomTabName()
Declaration
protected bool ShouldSerializeCustomTabName()
Returns
| Type |
|---|
| System.Boolean |
ShouldSerializeSelectedColor()
Declaration
protected bool ShouldSerializeSelectedColor()
Returns
| Type |
|---|
| System.Boolean |
ShouldSerializeStandardTabName()
Declaration
protected bool ShouldSerializeStandardTabName()
Returns
| Type |
|---|
| System.Boolean |
ShouldSerializeSystemTabName()
Declaration
protected bool ShouldSerializeSystemTabName()
Returns
| Type |
|---|
| System.Boolean |
Start(Color)
Displays the ColorUIControl control as a drop-down component.
Declaration
public void Start(Color clrselected)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | clrselected | The initially selected color. |
Start(Object, Color)
Displays the colorUI control as a drop-down component.
Declaration
[Obsolete("Use void Start(Color clrselected) instead!")]
public void Start(object obj, Color clrselected)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | |
| System.Drawing.Color | clrselected |
Events
ColorSelected
The ColorSelected event occurs when a color is selected from one of the palettes in the ColorUIControl.
Declaration
public event EventHandler ColorSelected
Event Type
| Type |
|---|
| System.EventHandler |