Description
Returns the color properties of the selected page object.
Syntax
Dim strColor as String = Page.GetObjColor (index) |
index
Required.
0 = border color and tint
1 = fill color and tint, or empty string if transparent, or color string without tint if direct CMYK color.
2 = gradient color and tint, or empty string if transparent, or color string without tint if direct CMYK color.
-1= gradient type and angle
Return values
Page.GetObjColor(0) returns border color and tint. It returns an empty string for frames, and may return"K,100" for picture if they get automatic border. See note for direct CMYK color.
Page.GetObjColor(1) returns fill color and tint. It returns an empty string for transparent boxes and frames and for any picture or rule. See note for direct CMYK color.
Page.GetObjColor(2) returns gradient color and tint. It returns an empty string for colored object which have no gradient color. See note for direct CMYK color.
Page.GetObjColor(-1) returns following values:
0,0 for colored object without gradient color,
1,0 for colored object with linear gradient, angle 0
1,200 for colored object with linear gradient, angle 20°
2,0 for colored object with circular gradient and angle 0
Note about CMYK (direct) colors: such colors are returned without tint value, e.g "#c20". White color "#c0m0y0k0" is returned as "#".
Context
Page designer
Example
dim strBorderColor as string = Page.GetObjColor(0)
dim strPaperColor as string = Page.GetObjColor(1)
dim strGradientColor as string = Page.GetObjColor(2)
dim strGradientType as string = Page.GetObjColor(-1)
msgbox (strBorderColor & vbcrlf & strPaperColor & vbcrlf & strGradientColor & vbcrlf & strGradienttype)
To retrieve values from color strings, use the following syntax (the example shows fill color):
dim strcolor, strTint
dim index = 1
dim aColorData = Split(Page.GetObjColor(index),",")
if isArray(aColorData) then
if uBound(aColorData) = 0 then strColor = aColorData(0)
if uBound(aColorData) = 1 then strTint = aColorData(1)
end if
See also
ObjSetBorderColor, ObjSetPaperColor, ObjSetPaperGradient, GetBoxData