Topaz Filer - Email filing software
GDI+ transformation problem: Scaling affects apparent linewidth
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.drawing.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

CS
Hi,
if I set a scale transformation in the Graphics object, not only are
coordinates scaled, but also for example line width of a drawing. Is there a
way to not have GDI+ scale line width, and still use the built-in
transformation system, or does one have to write a separate transformation
system in oder to get scale-independent line width? Basically, all I want is
to scale coordinates, but nothing that could be called an attribute.

Thanks!

Regards,
CS

Reply to this message...
Vote that this is a GOOD answer...
 
Double-click to open VS solution with elevated permissions on Windows 7
New BootFX DBGet build available
 
    
Bob Powell [MVP] (VIP)
You can do a couple of things.

#1 use a pen-width of -1. This ensures that all lines are drawn 1 pixel wide
regardless of the scaling.

#2 scale the pen-width to the reciprocal of the scale so if you scale by 5
the pen will be :
Pen p=new Pen(Color.Red,1f/5);

--
Bob Powell [MVP]
Visual C#, System.Drawing

Image transition effects, snap-to-grid and Layered Windows are
all discussed in May's edition of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml

"CS" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
 
System.Drawing.Color
System.Drawing.Pen




Ad
BootFX
Reliable and powerful .NET application framework.
Looking to invest in a major software project? Technical and commercial advice available here.
Other Helpful Sites
MBR 247
Topaz Filer
SharePoint Email Filing
Software Advisory Services
 
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734