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


ICustomColorPalette Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Framework > ESRI.ArcGIS.Framework > Interfaces > IC > ICustomColorPalette Interface
ArcGIS Developer Help

ICustomColorPalette Interface

Provides access to members that control the Setting or Creating of a Custom Color Palette.

Product Availability

Available with ArcGIS Desktop.

Description

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.

Members

Name Description
Write-only property ColorSet The Color Objects.

Classes that implement ICustomColorPalette

Classes Description
ColorPalette Esri Color Palette object.

Remarks

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)