Getting Started with Windows Forms ColorUI

11 Oct 20223 minutes to read

This section briefly describes how to create a new Windows Forms project in Visual Studio and add ColorUI with its basic functionalities.

Assembly deployment

Refer to the Control Dependencies section to get the list of assemblies or details of NuGet package that needs to be added as reference to use the control in any application.

Click NuGet Packages to learn how to install nuget packages in Windows Forms application.

Adding the ColorUI control via designer

  1. Create a new Windows Forms application in Visual Studio.

  2. The ColorUI control can be added to an application by dragging it from the toolbox to design view. The following dependent assemblies will be added automatically:

    • Syncfusion.Shared.Base

Drag and drop ColorUI from toolbox

Adding the ColorUI control via code

The following steps describe how to create a ColorUI control programmatically:

  1. Create a C# or VB application using Visual Studio.

  2. Add the following assembly reference to the project:

    • Syncfusion.Shared.Base
  3. Include the required namespace.

    using Syncfusion.Windows.Forms;
    Imports Syncfusion.Windows.Forms
  4. Create an instance of the ColorUI control, specify its size, and add it to the form.

    // Declaring and Initializing the control
    private Syncfusion.Windows.Forms.ColorUIControl colorUIControl1;
    this.colorUIControl1=new Syncfusion.Windows.Forms.ColorUIControl();
       
    //Specify the size for the control
    this.colorUIControl1.Size = new System.Drawing.Size(210, 200);
    Adding ColorUIControl to the form
    this.Controls.Add(this.colorUIControl1);
    ' Declaring and Initializing the control
    Private colorUIControl1 As Syncfusion.Windows.Forms.ColorUIControl
    Me.colorUIControl1 = New Syncfusion.Windows.Forms.ColorUIControl()
       
    'Specify the size for the control
    Me.colorUIControl1.Size = New System.Drawing.Size(210, 200)
       
    ' Adding ColorUIControl to the form
    Me.Controls.Add(Me.colorUIControl1)

    ColorUIControl

Select a color and group

At runtime, a particular color group tab should be focused or selected using the SelectedColorGroup property.

The options are as follows,

  • SystemColors
  • StandardColors
  • CustomColors
  • UserColors
  • None (Default)

Use the SelectedColor property to specify the initially selected color.

this.colorUIControl1.SelectedColor = System.Drawing.Color.OrangeRed;
this.colorUIControl1.SelectedColorGroup = Syncfusion.Windows.Forms.ColorUISelectedGroup.StandardColors;
Me.colorUIControl1.SelectedColor = System.Drawing.Color.OrangeRed
Me.colorUIControl1.SelectedColorGroup = Syncfusion.Windows.Forms.ColorUISelectedGroup.StandardColors

Windows Forms ColorUIControl showing selected groups and colors

NOTE

These property settings can be reset using the ResetSelectedColorGroup() and ResetSelectedColor() methods.