DotNetBar for Windows Forms includes color picker controls which display pre-defined set of colors in Office 2007/2010 color scheme.

To customize displayed colors use CustomStandardColors and CustomThemeColors properties which expect an array of array of ColorItem type that describe the color you want to display. The array in array structure is used so you can describe color lines. The inner array represents the single color line.

Here is sample code that shows how to customize standard colors:

C#:

colorPickerButton1.CustomStandardColors = new ColorItem[][] {
    new ColorItem[] {
        new ColorItem("","",Color.Red),
        new ColorItem("","",Color.GreenYellow),
        new ColorItem("","",Color.Green),
        new ColorItem("","",Color.AliceBlue),
        new ColorItem("","",Color.AntiqueWhite),
        new ColorItem("","",Color.Aqua),
        new ColorItem("","",Color.Aquamarine),
        new ColorItem("","",Color.Azure),
        new ColorItem("","",Color.Beige),
        new ColorItem("","",Color.Bisque)
    }
};

VB:

colorPickerButton1.CustomStandardColors = New ColorItem()() _
   { _
      New ColorItem() _
      { _
         New ColorItem("", "", Color.Red), _
         New ColorItem("", "", Color.GreenYellow), _
         New ColorItem("", "", Color.Green), _
         New ColorItem("", "", Color.AliceBlue), _
         New ColorItem("", "", Color.AntiqueWhite), _
         New ColorItem("", "", Color.Aqua), _
         New ColorItem("", "", Color.Aquamarine), _
         New ColorItem("", "", Color.Azure), _
         New ColorItem("", "", Color.Beige), _
         New ColorItem("", "", Color.Bisque)}}

Here is sample code that includes two lines of custom colors that replace theme colors:

C#:

colorPickerButton1.CustomThemeColors = new ColorItem[][] {
    new ColorItem[] {
        new ColorItem("","",Color.Beige),
        new ColorItem("","",Color.Bisque),
        new ColorItem("","",Color.Black),
        new ColorItem("","",Color.BlanchedAlmond),
        new ColorItem("","",Color.Blue),
        new ColorItem("","",Color.BlueViolet),
        new ColorItem("","",Color.Brown),
        new ColorItem("","",Color.BurlyWood),
        new ColorItem("","",Color.CadetBlue),
        new ColorItem("","",Color.Chartreuse)
    },
    new ColorItem[] {
        new ColorItem("","",Color.Chocolate),
        new ColorItem("","",Color.Coral),
        new ColorItem("","",Color.CornflowerBlue),
        new ColorItem("","",Color.Cornsilk),
        new ColorItem("","",Color.Crimson),
        new ColorItem("","",Color.Cyan),
        new ColorItem("","",Color.DarkBlue),
        new ColorItem("","",Color.DarkCyan),
        new ColorItem("","",Color.DarkGoldenrod),
        new ColorItem("","",Color.DarkGray)
    }
};

VB:

colorPickerButton1.CustomThemeColors = New ColorItem()() { _
  New ColorItem() { _
      New ColorItem("", "", Color.Beige), _
      New ColorItem("", "", Color.Bisque), _
      New ColorItem("", "", Color.Black), _
      New ColorItem("", "", Color.BlanchedAlmond), _
      New ColorItem("", "", Color.Blue), _
      New ColorItem("", "", Color.BlueViolet), _
      New ColorItem("", "", Color.Brown), _
      New ColorItem("", "", Color.BurlyWood), _
      New ColorItem("", "", Color.CadetBlue), _
      New ColorItem("", "", Color.Chartreuse)}, _
  New ColorItem() { _
      New ColorItem("", "", Color.Chocolate), _
      New ColorItem("", "", Color.Coral), _
      New ColorItem("", "", Color.CornflowerBlue), _
      New ColorItem("", "", Color.Cornsilk), _
      New ColorItem("", "", Color.Crimson), _
      New ColorItem("", "", Color.Cyan), _
      New ColorItem("", "", Color.DarkBlue), _
      New ColorItem("", "", Color.DarkCyan), _
      New ColorItem("", "", Color.DarkGoldenrod), _
      New ColorItem("", "", Color.DarkGray)}}

You can also add the custom menu item to the popup menu. Handle ColorPickerDropDown.PopupShowing event and use code like this:

C#:

private bool _CustomButtonAdded = false;
private void colorPickerDropDown1_PopupShowing(object sender, DevComponents.DotNetBar.PopupOpenEventArgs e)
{
    if (!_CustomButtonAdded)
    {
        ButtonItem button = new ButtonItem();
        button.Text = "More Options...";
        button.BeginGroup = true;
        button.Click += new EventHandler(CustomButtonClick);
        colorPickerDropDown1.SubItems.Add(button);
        ((MenuPanel)((PopupItem)button.Parent).PopupControl).RecalcLayout();
        _CustomButtonAdded = true;
    }
}

VB:

Private _CustomButtonAdded As Boolean = False
Private Sub colorPickerDropDown1_PopupShowing(sender As Object, e As DevComponents.DotNetBar.PopupOpenEventArgs)
	If Not _CustomButtonAdded Then
		Dim button As New ButtonItem()
		button.Text = "More Options..."
		button.BeginGroup = True
		button.Click += New EventHandler(CustomButtonClick)
		colorPickerDropDown1.SubItems.Add(button)
                Direct Cast(DirectCast(button.Parent, PopupItem).PopupControl, MenuPanel).RecalcLayout()
		_CustomButtonAdded = True
	End If
End Sub

Related posts:

  1. How to Customize DateTimeInput, DoubleInput, IntegerInput and TextBoxX colors
  2. How to create custom colors for RibbonTabItem and RibbonTabItemGroup objects
  3. How to change default ButtonX and ButtonItem colors, DotNetBar for WinForms
  4. How to change TabControl tab and panel colors
  5. How To Customize Office 2007 Color Table