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 > IColorPalette Interface (ArcObjects .NET 10.5 SDK) |
Provides access to members that control the Color Palette.
The ColorPalette is a pop-up style dialog that allows a user to select a particular color interactively.
Use this interface to allow a user to select a color interactively.
Description | ||
---|---|---|
Color | The Selected Color. | |
TrackPopupMenu | Show Color Palette. |
CoClasses and Classes | Description |
---|---|
ColorPalette | Esri Color Palette object. |
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().
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)