![]() |
This document is archived and information here might be outdated. Recommended version. |
| ArcObjects Help for .NET developers > ArcObjects namespaces > Framework > ESRI.ArcGIS.Framework > Interfaces > IC > ICustomColorPalette Interface (ArcObjects .NET 10.5 SDK) |
Provides access to members that control the Setting or Creating of a Custom Color Palette.
The ICustomColorPalette interface allows you to determine exactly which colors will be shown on the ColorPalette menu, instead of displaying the colors defined in the current Styles.
| Description | ||
|---|---|---|
![]() |
ColorSet | The Color Objects. |
| CoClasses and Classes | Description |
|---|---|
| ColorPalette | Esri Color Palette object. |
The following example shows how to display a ColorPalette with three simple colors. You would get m_app from the hook in ICommand::OnCreate().
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);
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)