Link to home
Start Free TrialLog in
Avatar of mikkon
mikkon

asked on

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.
Avatar of snoegler
snoegler

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.
Avatar of mikkon

ASKER

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.

ASKER CERTIFIED SOLUTION
Avatar of snoegler
snoegler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial