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

By using mature and robust KT.UI for ASP.NET ColorEditor control, users can choose whether let the control self automatically decide the width and column of color palette or customize the color editor width and columns based on your actual needs.
Technically speaking, the size of the color boxes in the palette is automatically set according to the Columns property that always fit the preset Width property by the ColorEditor component. Each box is of equal width and height. By default, the size of each color box is 15 x 15 pixels.
In this tutorial page, users can get the detailed instructions on setting ColorEditor width and column from following two modules:
  • Guides on whether and how to set ColorEditor columns using sample C# codes
  • Guides on whether and how to set ColorEditor width using sample C# codes

How to Use C# Demo Codes to Set Columns

Developers and end users are capable of setting the colors displayed in the color palette by using the Columns property in order to render the colors in appropriate color groups. By default, users can set this property as Preset that will automatically set the appropriate Columns property value so that the preset palette is rendered correctly.
When users don't want to set Column custom property, the columns value in the color palette is decided automatically by Preset. Please check C# sample codes below to set color column as Preset.

PerColorEditor2.Preset = ColorPreset.Metro;
PerColorEditor2.PaletteModes = PaletteModes.WebPalette;
When users choose to specify color collection, you can set the colors by setting the appropriate Columns property value. Learn to set column of ColorEditor from following C# codes.

PerColorEditor2.Preset = ColorPreset.Metro;
PerColorEditor2.PaletteModes = PaletteModes.WebPalette;
PerColorEditor2.Columns = 8;

How to Use C# Codes to Set Width with ColoreEditor

If users don't want to set the color box width, the size of the color boxes in the color palette will be automatically set based on the column property to fit the default width property. And also, users are also free to set color box width with the example C# codes just like setting color column.
If users don't customize the width property, ColorEditor will set it according to the appropriate default value. Check sample C# codes below.

PerColorEditor2.Preset = ColorPreset.Metro;
PerColorEditor2.PaletteModes = PaletteModes.WebPalette;
PerColorEditor2.Columns = 10;
When users begin to set Width property, the size of each color cell will be in accordance with each adjusted width. See following sample codes for adjusting width property.

PerColorEditor2.Preset = ColorPreset.Metro;
PerColorEditor2.PaletteModes = PaletteModes.WebPalette;
PerColorEditor2.Columns = 8;
PerColorEditor2.Width = 300;
ASP.NET AJAX UI Controls