Solved

Customizing a dotted CPen...

Posted on 1997-01-13
1
695 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Complete beginner needs help making a cron job 9 116
List out all word 7 286
Line meaning 9 85
Capture logon name 13 70
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

813 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

11 Experts available now in Live!

Get 1:1 Help Now