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


IColorSelector Interface (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Framework)  

IColorSelector Interface

Provides access to members that control the Color Selector Dialog.

Product Availability

Available with ArcGIS Desktop.

Description

Using the IColorSelector interface and the inherited IColorBrowser interface, you can present users with the ColorSelector dialog box.

 

Members

Description
Read/write property Color Color edited by the browser.
Method DoModal Show the browser.
Method InitPopupPosition Initialize Popup Position.

Inherited Interfaces

Interfaces Description
IColorBrowser Provides access to members that control the Color Browser Dialog.

CoClasses that implement IColorSelector

CoClasses and Classes Description
ColorSelector Esri Color Selector object.

Remarks

First, you may want to specify the color that is already displayed by the dialog box when the user first sees it�you can do this by setting the read/write Color property to any color object.

The InitPopupPosition method can be used to set the initial display location of the dialog box in screen coordinates.

To display the dialog box, you should call the DoModal method. The method takes one parameter, a handle to the parent Form, which is used to ensure the dialog box displays modally. The DoModal method returns a Boolean�you should check the result to determine if the user intended to cancel the action (the result is False) or click OK (the result is True).

To determine which color was selected, simply read the Color property.

The following code displays the color selector dialog.


 

[C#]

IColor pColor=new RgbColorClass();
pColor.RGB=255; //Red

IColorSelector pSelector=new ColorSelectorClass();
pSelector.Color=pColor;

//Display the dialog
if (pSelector.DoModal(m_app.hWnd))
{
  IColor pOutColor=pSelector.Color;
}

[Visual Basic .NET]

Dim pColor As IColor=New RgbColorClass()
pColor.RGB=255
'Red
Dim pSelector As IColorSelector=New ColorSelectorClass()
pSelector.Color=pColor

'Display the dialog
If pSelector.DoModal(m_app.hWnd) Then
 Dim pOutColor As IColor=pSelector.Color
End If

.NET Samples

Use an AlgorithmicColorRamp to color a ClassBreaksRenderer (Code Files: frmAlgorithmicColorRamp)