ArcObjects Library Reference (Framework)  

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

Description
Write-only property ColorSet The Color Objects.

CoClasses that implement ICustomColorPalette

CoClasses and 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)