User Interface / Widgets / Drop Down Edits / Color Box
In This Topic
    Color Box
    In This Topic

    The color box is a drop down edit, which displays a palette color picker in its popup window that allows the user to quickly select a color.

     Properties and Events

    The color box provides the following properties:

    • HasMoreColorsButton - specifies whether the color box should show a “More Colors…” button below the palette color picker or not.
    • SelectedColor - indicates the currently selected color. When the value of this property changes, the SelectedColorChanged event is fired.
    • Palette - specifies the palette of the color picker shown in the popup drop down of the color box. NOV provides the following predefined color palettes:
      Palette Description
      WebSafe A palette that contains the Web-safe colors.
      MicrosoftPaint A palette that contains the colors of the default Microsoft Paint palette.
      MicrosoftOffice2003 A palette that contains the colors of the default Microsoft Office 2003 palette.
      MicrosoftOffice2007 A palette that contains the colors of the default Microsoft Office 2007 palette.
      Custom Represents a palette with custom defined colors.
     Code Example

    The following piece of code demonstrates how to create a color box, change its palette and handle its SelectedColorChanged event:

    Color Box Example
    Copy Code
    NColorBox colorBox = new NColorBox();
    colorBox.Palette = new NColorPalette(ENColorPaletteType.MicrosoftOffice2007);
    colorBox.SelectedColorChanged += new Function<NValueChangeEventArgs>(OnColorBoxSelectedColorChanged);
    
    private void OnColorBoxSelectedColorChanged(NValueChangeEventArgs args)
    {
        NColorBox colorBox = (NColorBox)args.TargetNodeNode;
    }
    
    See Also