$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
How to Put up Color Palette of ColorEditor Using C#
Home > How to > Color Editor Color Palette

Overview of Color Palette of PerColorEditor Component

KT.UI for ASP.NET PerColorEditor provides users with the complete and easy to integrated color palette control. With the rich support of color palettes, users easily customize your custom color palette by setting the columns and width, and if it is necessary for you, you can combine your customized color palette with preset palette.
Our PerColorEditor is well developed to enable users to defining provided automatic color picker within the color palette object programmed by using PerColorEditor for ASP.NET AJAX. When users click the color pick button, it will open the full color palette and show the currently selected color. Besides color pick option, PerColorEditor still offers available control to set "No Color" and Color Preview on the color palette. For users have more advanced color editor appearance requirements, full and simple to select skins are available to set the visual appearance of the color palette, users also can use one of the predefined skins or create your own.

How to Set Color Palette Within C# by Using PerColorEditor

In this tutorial: how to set color palette for ASP.NET AJAX, we have talked about how to set color palette with three solutions by using ASPX demo codes. And in this part, we are going to discuss how to set color palette property within ASP.NET C# application by using KT.UI for ASP.NET AJAX PerColorEditor component.

How to Use C# Demo Codes to Set Color Palette by Setting Preset

Users can directly copy and paste following C# sample code to setting Preset property.

PerColorEditor2.Preset = ColorPreset.Metro;
PerColorEditor2.PaletteModes = PaletteModes.All;

How to Use C# Demo Codes to Set Color Palette by Using ColorEditorItem

When we use this property to set color palette, we are able to choose to add one color one time or add two or more colors at a time.
Following C# snippet codes are offered for adding one color to color palette at a time.

ColorEditorItem item1 = new ColorEditorItem();
item1.Title = "Red";
item1.Value = System.Drawing.ColorTranslator.FromHtml("#FF0000");
PerColorEditor2.Items.Add(item1);
ColorEditorItem item2 = new ColorEditorItem();
item2.Title = "Orange";
item2.Value = System.Drawing.ColorTranslator.FromHtml("#FF4500");
PerColorEditor2.Items.Add(item2);
ColorEditorItem item3 = new ColorEditorItem();
item3.Title = "Yellow";
item3.Value = System.Drawing.ColorTranslator.FromHtml("#FFFF00");
PerColorEditor2.Items.Add(item3);
ColorEditorItem item4 = new ColorEditorItem();
item4.Title = "Green";
item4.Value = System.Drawing.ColorTranslator.FromHtml("#008000");
PerColorEditor2.Items.Add(item4);
ColorEditorItem item5 = new ColorEditorItem();
item5.Title = "Blue";
item5.Value = System.Drawing.ColorTranslator.FromHtml("#0000FF");
PerColorEditor2.Items.Add(item5);
ColorEditorItem item6 = new ColorEditorItem();
item6.Title = "Black";
item6.Value = System.Drawing.ColorTranslator.FromHtml("#000000");
PerColorEditor2.Items.Add(item6);
ColorEditorItem item7 = new ColorEditorItem();
item7.Title = "White";
item7.Value = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
PerColorEditor2.Items.Add(item7);
C# example codes below are used to add two or more colors to color palette by using PerColorEditor each time within C# programming application.

PerColorEditor2.Items.AddRange(PerColorEditor2.GetStandardColors());
PerColorEditor2.Items.AddRange(PerColorEditor2.GetFlowColors());

How to Use C# Demo Codes to Set Color Palette with Preset and ColorEditorItem

Following demo C# codes show you how to set color palette by setting both Preset and ColorEditorItem Properties.

PerColorEditor2.Preset = ColorPreset.Metro;
PerColorEditor2.PaletteModes = PaletteModes.All;
ColorEditorItem item1 = new ColorEditorItem();
item1.Title = "Red";
item1.Value = System.Drawing.ColorTranslator.FromHtml("#FF0000");
PerColorEditor2.Items.Add(item1);
ColorEditorItem item2 = new ColorEditorItem();
ASP.NET AJAX UI Controls