Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Changing rule thickness

Posted on 1998-01-19
3
Medium Priority
?
212 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 100 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

Technology Partners: 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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

610 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