C1Ribbon (Classic) Task-Based Help / Changing the Color Picker Theme Colors
Changing the Color Picker Theme Colors

The RibbonColorPicker has two sections the theme colors and the standard colors:


You can change the theme colors by modifying the OfficeColorPalette property through the Properties window or programmatically.

To Change the Color Picker Theme Using the Properties Window

You can change the OfficeColorPalette property using the Properties window. Add a color picker to the Ribbon group, and then click the color picker item to reveal the RibbonColorPicker properties in the Properties window. Locate the OfficeColorPalette property's drop-down arrow and select the new color theme from the list, for example, Metro:


To Change the Color Picker Theme Programmatically

Note: In the following example an embedded resource containing the FontColor.png (16x16) image is used. To embed a resource, from the Project menu, choose YourProjectName Properties. From the Resources tab, select Add Resource and choose to an existing file or add a new one.

To change the color picker's theme to Office2007ColorThemes.Metro, for example, add the following code to your project:

To write code in Visual Basic

Visual Basic
Copy Code
' type the Imports directive for the namespace
Imports C1.Win.C1Ribbon
 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
    Dim ColorPicker As RibbonColorPicker = New RibbonColorPicker()
 
    ' add a color picker to the group
    RibbonGroup1.Items.Add(ColorPicker)
 
    ' add the FontColor image to your Resources folder
    ' set the image for the color picker
    ColorPicker.SmallImage = Properties.Resources.FontColor
 
    ' set the theme color for the color picker
    ColorPicker.OfficeColorPalette = Office2007ColorThemes.Metro
End Sub

To write code in C#

C#
Copy Code
// type the using directive for the namespace
using C1.Win.C1Ribbon;
 
private void Form1_Load(object sender, System.EventArgs e)
{
    RibbonColorPicker ColorPicker = new RibbonColorPicker();
 
    // add a color picker to the group
    ribbonGroup1.Items.Add(ColorPicker);
 
    // add the FontColor image to your Resources folder
    // set the image for the color picker
    ColorPicker.SmallImage = Properties.Resources.FontColor;
 
    // set the theme color for the color picker
    ColorPicker.OfficeColorPalette = Office2007ColorThemes.Metro;
}

This topic illustrates the following:

Run the application, and click the color picker. The new color theme is visible under the Theme Colors section: