Nevron Open Vision Documentation
Palette Color Picker

The palette color picker is a table picker that lets the user pick a color from a predefined palette of colors. The palette to use may be passed as a parameter to the palette color picker constructor or may be assigned to its Palette property. The image below shows a palette color picker that displays the Microsoft Office 2007 palette:

Properties and Events

The palette color picker provides the following properties:


Code Example

The palette color picker at the beginning of this article can be generated by the following piece of code:

Palette Color Picker Example
Copy Code
NColorPalette palette = new NColorPalette(ENColorPaletteType.MicrosoftOffice2007);
NPaletteColorPicker colorPicker = new NPaletteColorPicker(palette);
colorPicker.SelectedColor = NColor.Yellow;
colorPicker.SelectedIndexChanged += new Function<NValueChangeEventArgs>(OnColorPickerSelectedIndexChanged);

When the user selects a new color from the palette color picker the SelectedIndexChanged event is raised and the value of the picker’s SelectedColor property is updated. The example below shows how you can handle it:

SelectedIndexedChanged event handler
Copy Code
private void OnColorPickerSelectedIndexChanged(NValueChangeEventArgs arg1)
    // Get the palette color picker, whose selected color has changed
    NPaletteColorPicker colorPicker = (NPaletteColorPicker)arg1.CurrentTargetNode;

    // Get the selected color
    NColor selectedColor = colorPicker.SelectedColor;
See Also
Send Feedback