CPen::CPen

Syntax

CPen();

CPen( int nPenStyle, int nWidth, DWORD crColor )
throw( CResourceException );

Parameters

nPenStyle

Specifies the pen style. This parameter can be one of the following values:

Value Meaning

PS_SOLID Creates a solid pen.
PS_DASH Creates a dashed pen. Valid only when the pen width is 1.
PS_DOT Creates a dotted pen. Valid only when the pen width is 1.
PS_DASHDOT Creates a pen with alternating dashes and dots. Valid only when the pen width is 1.
PS_DASHDOTDOT Creates a pen with alternating dashes and double-dots. Valid only when the pen width is 1.
PS_NULL Creates a null pen.
PS_INSIDEFRAME Creates a pen in which a line is drawn inside the frame of ellipses and rectangles produced by using the Ellipse, Rectangle, and RoundRect Windows functions.

nWidth

Specifies width (in pixels) of the pen.

crColor

Contains an RGB color for the pen.

Remarks

If you use the constructor with no arguments, you must initialize the resulting CPen object with CreatePen, CreatePenIndirect, or CreateStockObject. If you use the constructor that takes arguments, then no further initialization is necessary.

The constructor with arguments can throw an exception if errors are encountered, while the constructor with no arguments will always succeed.

See Also

CPen::CreatePen, CPen::CreatePenIndirect, CGdiObject::CreateStockObject