| Methods Index |
Subclasses: None
CPen class encapsulates XVT pens. Objects of this type describe a color pen for drawing lines, but not for filling in shapes with an interior (use a CBrush for that). Each window has its own current CPen. The CPen object describes the color, the pattern, the style, and the width of the pen. The color is indicated by RGB values. XVT uses a 24-bit number to specify a color. The 24 bits are divided into three 8-bit values for the red, green, and blue components.
For your convenience, XVT provides symbols for the colors in Table 11. You can use other colors if you wish. However, if your target platform doesn't flexibly support color, XVT recommends that you use one of the predefined colors.
The pattern indicates the pen pattern, which has the allowable values shown in Table 12. The style indicates the style used by the pen, which has the predefined values shown in Table 13. The width is the width of the pen stroke in pixels.
Style Symbol
Description
P_SOLID
Solid line
P_DOT
Dotted line
P_DASH
Dashed line
CBrush. For
information on drawing modes and other "environmental"
attributes, see CEnvironment.
CPen aPen(COLOR_RED, PAT_SOLID, P_SOLID, 1);
CPEN anXVTPen = aPen;
xvt_dwin_set_cpen(itsXVTWindow, &anXVTPen);
xvt_dwin_set_back_color(itsXVTWindow, aPen.GetColor());
Protected Data Members
CPen Attributes
CPEN
itsPen;
The pen
Public Methods
Constructor, Destructor, and Initializer Methods
CPen();
CPen(COLOR theColor,
PAT_STYLE thePattern,
PEN_STYLE theStyle = P_SOLID,
short theWidth = 1);
CPen(CPEN thePen);
CPEN object.
CPen(const CPen &theImage);
CPen object associated with the specified image.
CPen & operator= (const CPen &thePen);
CPen specified by thePen.
~CPen();
operator CPEN () const;
CPEN. Since this method returns a direct reference into internal information, use this method carefully. Specifically, do not use this method in cases in which the calling method might destroy or alter the handle.
CPen & operator= (CPEN thePen);
CPEN.
void IPen(COLOR theColor,
PAT_STYLE thePattern,
PEN_STYLE theStyle = P_SOLID,
short theWidth = 1);
theColor), pattern (thePattern), style (theStyle), and width (theWidth).
void SetColor(COLOR theColor);
void SetPattern(PAT_STYLE thePattern);
void SetStyle(PEN_STYLE theStyle);
void SetWidth(short theWidth);
COLOR GetColor(void) const;
PAT_STYLE GetPattern(void) const;
PEN_STYLE GetStyle(void) const;
short GetWidth(void) const;