Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Creating a True Dotted Pen

0.00/5 (No votes)
23 Jun 2004 1  
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.

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