Click to See Complete Forum and Search --> : I want a thinner pen width, How?


Tonio
March 29th, 1999, 10:11 PM
Good Day!

How do I set my CPen object to have thinner width than that of default

pen width. Is it possible to maintain a hair-like-pen-width regardless

of the mapping mode settings?

I've tried using 0 as width but, the output lines were thicker than

what I need.

I can't switch to a higher resolution mapping mode (that is from MM_LOMETRIC

to MM_HIMETRIC) because GDI functions are limited to a maximum of 32767 and minimum of -32767 x and y values.

How could I get around this problem?

Thanks in advance.

Daren Chandisingh
March 30th, 1999, 02:24 AM
Which constructor are you using? There are more than one for a CPen object.


According to the help:


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 );



nWidth Specifies the width of the pen.


For the first version of the constructor, if this value is 0, the width in device units is always 1 pixel, regardless of the mapping mode.


For the second version of the constructor, if nPenStyle is PS_GEOMETRIC, the width is given in logical units. If nPenStyle is PS_COSMETIC, the width must be set to 1.


So if you use the first constructor, the width of the pen should

always be a single pixel and you get your hair-like pen.