• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

Using wide pens on anisotropic DC's

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
mikkon
Asked:
mikkon
  • 2
1 Solution
 
snoeglerCommented:
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
 
mikkonAuthor Commented:
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
 
snoeglerCommented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now