Solved

Using wide pens on anisotropic DC's

Posted on 1998-10-01
3
194 Views
Last Modified: 2013-12-03
I have a DC that uses anisotropic mapping mode. I am trying to draw lines wider than 1 pixel onto this DC as follows:
 
ptarray[0].x=ptarray[0].y=0;
...
ptarray[5].x=2;         // Pen width
ptarray[5].y=0;        
DPtoLP (hDC,ptarray,6);
HeavyPenWidth=ptarray[5].x-ptarray[0].x;
hBluePen2=CreatePen(PS_SOLID,HeavyPenWidth,Disabled?RGB(128,128,128):RGB(0,0,128));

This works fine on Windows 95: the lines drawn with the pen look nicely "bold" compared to 1-pixel lines. However, on Windows NT, the lines drawn with the pen are HeavyPenWidth logical units wide and high. Because my mapping mode is far from the screen's aspect ratio, vertical lines are drawn wide, but horizontal lines are much thinner.

Is there a way of specifying the pen widths in device units? Changing the mapping mode is out of question.
0
Comment
Question by:mikkon
  • 2
3 Comments
 
LVL 6

Expert Comment

by:snoegler
ID: 1414943
No, there isn't. At least not using GDI functions - you _will_ need to change the mapping mode.
Isn't there a way to remap the old mapping mode manually to pixels? Then you'd just
need to recalculate the new line origins and draw it, and then change back to the old mode.
This should be possible, as the mapping mode is just a mathematic transformation.
0
 
LVL 1

Author Comment

by:mikkon
ID: 1414944
Of course, you mean converting logical coordinates to device coordinates (LPtoDP), changing the mapping mode to MM_TEXT, drawing the line with device coordinates and changing back to the original mapping mode. Sound good; answer this question and you'll get the points.

0
 
LVL 6

Accepted Solution

by:
snoegler earned 100 total points
ID: 1414945
Thank you - I forgot this LPtoDP function, which does the mapping for you. So i think 50% of
the points should go to yourself - but this isn't possible :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

932 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

8 Experts available now in Live!

Get 1:1 Help Now