Shiny Language Reference
Language Reference > Drawing Functions
setpencol
setpencol(pen PenVar, int RGBColour);
Synonyms:
setpencolour(pen PenVar, int RGBColour);
Sets the colour of the specified pen
SETPENCOL sets the colour of the specified pen. The pen should have previously been initialized using CREATEPEN, as every call to CREATEPEN resets the RGB colour of the pen to the supplied RGBColour parameter. Therefore calling SETPENCOL before CREATEPEN is redundant. This statement only sets the colour of a pen and does not select it for use, therefore it can be called in any handler.
This statement should be used in preference to CREATEPEN when the only requirement is to change the colour of an existing pen. This statement is significantly faster for simply changing the colour of the pen.
The purpose of this statement and the PEN type is roughly equivalent to the Win32API HPEN object.
Parameters
PenVar
A variable declared as type PEN to change the colour of.
RGBColour
The new colour for the pen, specified as an RGB value packed to an integer. Use the RGB statement to create this value.
Return Value
None
Example Code
// Initialize MyPen as a solid, 3 pixel wide red pen
pen MyPen;
createpen(MyPen, 0, 3, RGB(255, 0, 0));
// Now change the pen colour to green
setpencol(MyPen, RGB(0, 255, 0));