Project Description
Office 2010 style color picker control for C#, VB.NET WinForm's color dialog.

This is a small component for a programming language of C# WinForm.

There is currently only 1 style in this project. If you have some other color picker that would like to share, you may join this project, commit your codes and creates the demo as new release.

Another rebuild Office 2010 Style color picker.
theme.png

Three components are built based on Office 2010 Style color picker:
  • ThemeColorPicker - Used in WinForm
  • ThemeColorPickerWindow - A small pop-up tool box
  • ThemeColorPickerToolStripButton - A ToolStripButton used in Tool Strip Control

How to Use
  1. Add a reference of ThemeColorPicker into your project.

ThemeColorPicker

screenshotdemo2.png
  1. If you add the source code directly into project, `ThemeColorPicker` should appear at the ToolBox.
  2. However, if you can't the it at ToolBox, you can try drag n drop the DLL into the ToolBox.
  3. Then, drag and drop it from ToolBox into WinForm.
  4. If you can't drag and drop from ToolBox, you can manually add it in the Form's Designer.cs file.
  5. Double click on the control to create/handle the event of ColorSelected.
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void themeColorPicker1_ColorSelected(object sender, ColorSelectedArg e)
    {
        this.BackColor = e.Color;
    }
}

ThemeColorWindow
private void button1_Click(object sender, EventArgs e)
{
    Point pt = this.PointToScreen(button1.Location);
    ThemeColorPickerWindow f = new ThemeColorPickerWindow(
        pt,
        System.Windows.Forms.FormBorderStyle.FixedToolWindow,
        ThemeColorPickerWindow.Action.CloseWindow,
        ThemeColorPickerWindow.Action.CloseWindow);
    f.ColorSelected += new ThemeColorPickerWindow.colorSelected(f_ColorSelected);
    f.Show();
}

void f_ColorSelected(object sender, ColorSelectedArg e)
{
    this.BackColor = e.Color;
}

ThemeColorPickerToolStripSplitButton
  • You can see a new option of adding a ThemeColorPickerToolStripButton at the tool strip:
toolstrip2.png
When ToolStripSplitButton is added into the form for the 1st time, you'll find that the icon seems to be not complete drawn. But...
toolstrip3.png
The icon will become normal after the 1st run. It will always be normal while running the program.
toolstrip4.png
Screenshot
toolstrip5.png
Handle the ColorSelected event at code behind:
public Form1()
{
    InitializeComponent();
    themeColorPickerToolStripSplitButton1_ColorSelected.ColorSelected += new ThemeColorPickerToolStripSplitButton1_ColorSelected.colorSelected(themeColorPickerToolStripButton1_ColorSelected);
}

void themeColorPickerToolStripSplitButton1_ColorSelected_ColorSelected(object sender, ColorSelectedArg e)
{
    this.BackColor = e.Color;
}

Last edited Aug 23, 2013 at 12:53 PM by adriancs, version 13