ColorPicker_SetColor
int ColorPicker_SetColor (int panel, int control, int color);
Purpose
Sets the active color to the specified color, updating a custom color cell if necessary.
If the specified color already exists in a fixed or custom color cell, this function selects that color cell. If the color does not exist, the function selects the first unused custom color cell, sets it to the specified color, and selects it. If all custom color cells have been used, the function replaces the color of one of the existing custom color cells, and selects it. If no custom color cells exist, ColorPicker_SetColor selects the fixed cell with the color that most closely matches the specified color. If the control contains no custom color cells or fixed color cells, this function sets the color of the gradient and shade areas of the control without selecting a cell.
Parameters
| Input | ||
| Name | Type | Description |
| panel | int | The specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel. |
| control | int | The ID you specified as the canvas parameter in the ColorPicker_Convert function call. This value must be the same as the defined constant, located in the .uir header file, that you assigned to the original canvas control. |
| color | int | Color to set. If the color exists in a fixed or custom color cell, that cell is selected. Otherwise, an existing custom cell is populated with that color. If there are no custom color cells, the fixed cell with the closest color is selected. Specify the color as an RGB value, which is a 4-byte integer with the hexadecimal format 0x00RRGGBB. RR, GG, and BB are the respective red, green, and blue components of the color value. You also can use the User Interface Library function, MakeColor, to create an RGB value from red, green, and blue color components. |
Return Value
| Name | Type | Description |
| status | int | Return value indicating whether the function was successful. A negative number indicates that an error occurred. |
Additional Information
Library: Color Picker Control
Include file: custctrl\color_picker.h
LabWindows/CVI compatibility: LabWindows/CVI 9.0 and later