Solved

Customizing a dotted CPen...

Posted on 1997-01-13
1
704 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 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