This document is archived and information here might be outdated.  Recommended version.


IColorPalette Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > ArcObjects namespaces > Framework > ESRI.ArcGIS.Framework > Interfaces > IC > IColorPalette Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Framework)  

IColorPalette Interface

Provides access to members that control the Color Palette.

Product Availability

Available with ArcGIS Desktop.

Description

The ColorPalette is a pop-up style dialog that allows a user to select a particular color interactively.

When To Use

Use this interface to allow a user to select a color interactively.

Members

Name Description
Read-only property Color The Selected Color.
Method TrackPopupMenu Show Color Palette.

CoClasses that implement IColorPalette

CoClasses and Classes Description
ColorPalette Esri Color Palette object.

Remarks

The ColorPalette provides options to the user to show further color dialogs. Clicking the 'More Colors' option will display the ColorSelector dialog, which in turn allows the user to display the ColorBrowser dialog. In this way, the ColorPalette provides the developer with a simple way to allow the user to select from the full range of colors and color models available.

The following example shows how to display a ColorPalette with three simple colors. You would get m_app from the hook in ICommand::OnCreate().

[C#]
ISet colorSet=new SetClass();
IColor color=new RgbColorClass();
color.RGB=255; //Red
colorSet.Add(color);
color=new RgbColorClass();
color.RGB=65535; //Yellow
colorSet.Add(color);
color=new RgbColorClass();
color.RGB=65280; //Green
colorSet.Add(color);
ICustomColorPalette customColorPalette=new ColorPaletteClass();
customColorPalette.ColorSet=colorSet;
IColorPalette colorPalette=customColorPalette as IColorPalette;
tagRECT tagRect=new tagRECT();
tagRect.left=100;
tagRect.right=500;
tagRect.bottom=100;
tagRect.top=500;
colorPalette.TrackPopupMenu(ref tagRect, color, false, m_app.hWnd);
[Visual Basic .NET]
Dim colorSet As ISet=New SetClass()
Dim color As IColor=New RgbColorClass()
color.RGB=255
'Red
colorSet.Add(color)
color=New RgbColorClass()
color.RGB=65535
'Yellow
colorSet.Add(color)
color=New RgbColorClass()
color.RGB=65280
'Green
colorSet.Add(color)
Dim customColorPalette As ICustomColorPalette=New ColorPaletteClass()
customColorPalette.ColorSet=colorSet
Dim colorPalette As IColorPalette=TryCast(customColorPalette, IColorPalette)
Dim tagRect As New tagRECT()
tagRect.left=100
tagRect.right=500
tagRect.bottom=100
tagRect.top=500
colorPalette.TrackPopupMenu(tagRect, color, False, m_app.hWnd)