tags:

views:

39

answers:

1

Hi,

Not sure if anyone else has seen this, but I am rendering a custom control that has zoom functionality. Lets say for simplicity sake that I am just drawing one rectangle with border width = 1 in the viewable area of the control. When I alter the zoom (graphics.ScaleTransform()) the rectangle's borders take on different sizes (sometimes the same, mostly different). This makes my control look ugly when the user zooms in or out. I'm sure it's something really simple but i'm struggling to fix it. Any help appreciated!

thanks,

Thornza

+1  A: 

Yes, the pen width gets scaled as well. Create a pen with a Width = 0. That will always be one pixel wide, regardless of the ScaleTransform.

Hans Passant
Cool - that works thanks man. I'm going to do that from now on, but I still think that the GDI+ engine is a bit buggy with regard to the way that it is scaling the pen widths. I mean, I have a rectangle and for certain scale factors the top horizontal line is a different width to the bottom horizontal line - which makes no sense to me. But thanks a lot for this work around - really appreciate it.
Thornza
Okay, please close your thread by marking the answer.
Hans Passant