Solved

Using wide pens on anisotropic DC's

Posted on 1998-10-01
3
186 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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