VCGetColorRef
VCSetColorRef


Version:

5.0

Description:

Sets a COLORREF (RGB value) in the global color palette for the given color index.

Declaration:

 

C/C++

extern "C" COLORREF WINAPI VCGetColorRef(short* iError, short iIndex);
extern "C" COLORREF WINAPI VCSetColorRef(short* iError, short iIndex, COLORREF crColor);

Delphi

function VCGetColorRef (var iError: Smallint; iIndex: Smallint): Longint; stdcall;
function VCSetColorRef (var iError: Smallint; iIndex: Smallint; crColor: Longint): Longint; stdcall;

ActiveX/COM

Function GetColorRef(ByVal iIndex As Integer) As DWORD
Function SetColorRef(ByVal iIndex As Integer, ByVal crColor As DWORD) As DWORD

Parameters:

iIndex - the color index from 0 to 255.
crColo
r - the RGB value to set.

Return Value:

If VCGetColorRef succeeds, the return value is the COLORREF (RGB value) for the specified index. If an error occurs, the return value is 0.
If VCSetColorRef succeeds, the return value is the COLORREF (RGB value) being replaced. If an error occurs, the return value is 0.

iError Code:

0 - Success
1 - Invalid world
2 - Index out of range

Notes:

Visual CADD™ has a customizable pallet of 256 colors that it uses to draw to the screen or printer. This pallet is used for all entity types in all drawings opened during a Visual CADD™ session. These colors are stored as RGB values that are read from the VGA.PAL in the System folder at program startup. Each pallet entry has an index, a color (RGB value) and an optional name associated with it. Entities and global settings that have a color associated with them store a color index value and not an actual color value. Though VCSetColorRef allows the RGB values to be changed, this call only affects the current session of the program. If you want to change colors across Visual CADD™ sessions you need call VCSaveColorPalette.

See Also:

VCLoadColorPalette, VCSaveColorPalette, VCGetColorName, VCSetColorName, VCGetColorIndex, VCSetColorIndex