Click here to Skip to main content
13,051,447 members (47,147 online)
Click here to Skip to main content
Add your own
alternative version


9 bookmarked
Posted 23 Jun 2004

Creating a true dotted pen

, 23 Jun 2004
Rate this:
Please Sign up or sign in to vote.
A fix for creating pens using PS_DOT.


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.lbColor = c_colorGridLine;

LogBrush.lbStyle = PS_SOLID;

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


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

Web Developer
United States United States
Industrial strength automation programmer;

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
nv317-Jul-12 5:46
membernv317-Jul-12 5:46 
GeneralAnother suggestion Pin
Franz Brunner27-Sep-04 4:58
memberFranz Brunner27-Sep-04 4:58 
GeneralRe: Another suggestion Pin
Alexandre GRANVAUD4-Apr-06 4:25
memberAlexandre GRANVAUD4-Apr-06 4:25 
GeneralIncorrect parameter Pin
Robert Edward Caldecott24-Jun-04 5:40
memberRobert Edward Caldecott24-Jun-04 5:40 
GeneralPS_ALTERNATE not available on Win9x Pin
Robert Edward Caldecott24-Jun-04 5:36
memberRobert Edward Caldecott24-Jun-04 5:36 
GeneralRe: PS_ALTERNATE not available on Win9x Pin
MaxHacker24-Jun-04 7:07
memberMaxHacker24-Jun-04 7:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web01 | 2.8.170713.1 | Last Updated 24 Jun 2004
Article Copyright 2004 by MaxHacker
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid