Solved

Changing rule thickness

Posted on 1998-01-19
3
196 Views
Last Modified: 2010-04-10
I'm a VC++ version 5 programmer. I trying to create a 1 point rule with the CPen class. What should I make the nWidth parameter?
0
Comment
Question by:smcinnis011998
[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
  • 3
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1178516
Answer comming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1178517
If you want to work in the default mapping mode, MM_TEXT, then you must determine the number of pixels per point.  A point is approximately 1/72 of an inch.  You can use GetDeviceCaps() to get the number of pixels per inch using LOGPIXELSX or LOGPIXELSY.
then a the pen width should be
(Desired_ointSize)*(pixels_per_inch)/72

Note that if the line is diagonal and the X and Y pixel density is not the same, things get tougher.  However the pixel density is usually the same in both directions.  It can be worked out with a little trig, if necessary.

The other option, however, is to change to a different mapping mode.  In the MM_TWIPS mode a point is 72 units.  (twips are 1/72 of a point, I believe).  Other mapping modes could be used as well.

0
 
LVL 22

Expert Comment

by:nietod
ID: 1178518
I was wrong about the twip size.  A twip is 1/20th of a point.  so a 1 point lines is 20 twips.
0

Featured Post

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
computer science syllabus 3 115
Using Diagnostic tools in VS2015: Unresoved allocations 19 141
boost::uuid crashes 17 60
keep track of class structure 1 52
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

738 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