CPen::CPen

CPen( );

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

CPen( int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL );
throw( CResourceException );

Parameters

nPenStyle

Specifies the pen style. This parameter in the first version of the constructor can be one of the following values:

nWidth

Specifies the width of the pen.

crColor

Contains an RGB color for the pen.

pLogBrush

Points to a LOGBRUSH structure. If nPenStyle is PS_COSMETIC, the lbColor member of the LOGBRUSH structure specifies the color of the pen and the lbStyle member of the LOGBRUSH structure must be set to BS_SOLID. If nPenStyle is PS_GEOMETRIC, all members must be used to specify the brush attributes of the pen.

nStyleCount

Specifies the length, in doubleword units, of the lpStyle array. This value must be zero if nPenStyle is not PS_USERSTYLE.

lpStyle

Points to an array of doubleword values. The first value specifies the length of the first dash in a user-defined style, the second value specifies the length of the first space, and so on. This pointer must be NULL if nPenStyle is not PS_USERSTYLE.

Remarks

If you use the constructor with no arguments, you must initialize the resulting CPen object with the CreatePen, CreatePenIndirect, or CreateStockObject member functions. 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.

CPen OverviewClass MembersHierarchy Chart

See Also   CPen::CreatePen, CPen::CreatePenIndirect, CGdiObject::CreateStockObject