Solved

Customizing a dotted CPen...

Posted on 1997-01-13
1
692 Views
Last Modified: 2013-11-20
I want to draw a grid on my DC.  Logically, a CPen  would be used.  When I create the CPen, I use the  PS_DOT option -  This is almost correct, but I would really like to allow the dots to be further apart...  How do I do this?
0
Comment
Question by:skink
1 Comment
 
LVL 1

Accepted Solution

by:
chedrick earned 50 total points
ID: 1300097
There are two versions of CPen::CreatePen. Use this one:
BOOL CreatePen( int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL );

There is also an alternate constructor that allows you to use those (very important) last two arguments.

By setting the style to PS_USERSTYLE, the last two arguments allow you to pass an array of DWORDS that contains the line characteristics (dash and space lengths). nStyleCount is the number of (DWORD) elements in the array.
This array contains the dash/space pair values respectively.

You can use GetExtLogPen(...) to get the default values of this array and modify the array values to suit you specific needs.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now