This document is archived and information here might be outdated. Recommended version. |
Provides access to members that control the Color Selector Dialog.
Using the IColorSelector interface and the inherited IColorBrowser interface, you can present users with the ColorSelector dialog box.
Name | Description | |
---|---|---|
Color | Color edited by the browser. | |
DoModal | Show the browser. | |
InitPopupPosition | Initialize Popup Position. |
Interfaces | Description |
---|---|
IColorBrowser | Provides access to members that control the Color Browser Dialog. |
CoClasses and Classes | Description |
---|---|
ColorSelector | Esri Color Selector object. |
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.
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;
}
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