CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Location
    Philippines
    Posts
    46

    I want a thinner pen width, How?



    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.



  2. #2
    Join Date
    Apr 1999
    Posts
    32

    Re: I want a thinner pen width, How?



    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured