A NPalette object exposes lots of different color values used by various controls to render parts of them. For example, a NProgressBar uses ControlLight color to draw its background and PressedDark to render its progress area. A NToolbar uses ControlLight and ControlDark to create a gradient for its background.
The following example demonstrates customizing features of a palette:
C# |
Copy Code
|
---|---|
this.nButton1.Palette.Scheme = ColorScheme.LunaBlue;
|
Visual Basic |
Copy Code
|
---|---|
Me.nButton1.Palette.Scheme = ColorScheme.LunaBlue
|
C# |
Copy Code
|
---|---|
this.nCheckBox1.HighlightLight = Color.Yellow;
|
Visual Basic |
Copy Code
|
---|---|
Me.nCheckBox1.HighlightLight = Color.Yellow
|
C# |
Copy Code
|
---|---|
this.nPanelBar1.Palette.SetColorTable(myColorTable);
|
Visual Basic |
Copy Code
|
---|---|
Me.nPanelBar1.Palette.SetColorTable(myColorTable)
|
C# |
Copy Code
|
---|---|
this.nProgressBar1.Palette.Style3D = Style3D.Light3D;
|
Visual Basic |
Copy Code
|
---|---|
Me.nProgressBar1.Palette.Style3D = Style3D.Light3D
|
C# |
Copy Code
|
---|---|
this.nTabControl1.Palette.UseThemes = false; |
Visual Basic |
Copy Code
|
---|---|
Me.nTabControl1.Palette.UseThemes = False |
The NPalette object provides an extensible way for preserving some settings discarding the current global ones. For example, if you want to have a certain button that will always have 3D-style Style3D.Flat - you can achieve this via the PaletteInheritance property.
Following is a list of the flags in this enumeration:
The Suite provides a convenient visual editor to be used both at design and run-time to edit the inheritance of a palette:
The following example demonstrates how to preserve the 3D-style of a INPaletteProvider:
C# |
Copy Code
|
---|---|
this.nRadioButton1.Palette.Inheritance = PaletteInheritance.ColorTable | PaletteInheritance.UseThemes;
|
Visual Basic |
Copy Code
|
---|---|
Me.nRadioButton1.Palette.Inheritance = PaletteInheritance.ColorTable Or PaletteInheritance.UseThemes |
The NPalette object provides an advanced visual editor available at both design and run time, which provides rich support in editing and customizing its properties.
The NPalette object provides powerful and intuitive visual editor to edit its properties.
The editor can also be triggered from code via the ShowEditor method of the NPalette object. Use the combo box at the top-left corner of the editor to choose a predefined ColorScheme. Or select a color property, edit it using the color picker on the right and press the "Apply Color" button to confirm editing. Confirm palette change by pressing the "OK" button or cancel it using the "Cancel" button. Restore default palette settings using the "Default" button. Use the "Save" button to save a current state of the palette to a file or use the "Load" button to load previously saved palette.