Click here to Skip to main content
Licence 
First Posted 23 Jun 2004
Views 37,314
Bookmarked 9 times

Creating a true dotted pen

By | 23 Jun 2004 | Article
A fix for creating pens using PS_DOT.

Introduction

I found that creating a pen using PS_DOT ...

COLORREF c_colorGridLine = RGB(190,190,190);
CPen penDotted(PS_DOT, 0, c_colorGridLine);

...really looked more like a dash. In my application, I wanted to draw very light weight grid lines. I found the following works very nicely, and hope you may find it useful as well:

    LOGBRUSH LogBrush;

    LogBrush.lbColor = c_colorGridLine;

    LogBrush.lbStyle = PS_SOLID;

    penDotted.CreatePen( PS_COSMETIC | PS_ALTERNATE , 1, &LogBrush, 0, NULL );

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

MaxHacker

Web Developer

United States United States

Member

Industrial strength automation programmer;

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralAnother suggestion PinmemberFranz Brunner4:58 27 Sep '04  
GeneralRe: Another suggestion PinmemberAlexandre GRANVAUD4:25 4 Apr '06  
GeneralIncorrect parameter PinmemberRobert Edward Caldecott5:40 24 Jun '04  
GeneralPS_ALTERNATE not available on Win9x PinmemberRobert Edward Caldecott5:36 24 Jun '04  
GeneralRe: PS_ALTERNATE not available on Win9x PinmemberMaxHacker7:07 24 Jun '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 24 Jun 2004
Article Copyright 2004 by MaxHacker
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid