views:

167

answers:

0

System.Drawing:

I found a post (with no answer) that explains my problem very nicely:

http://groups.google.com/group/microsoft.public.test.here/browse_thread/thread/21b768eb66270b9d?hl=en&ie=UTF-8&q=Pen+width+scaletransform+group:microsoft*#47964cfcad0d0bc8

I'm having trouble controlling the Pen width where the graphics are transformed. Either it's 1 pixel or it snaps up to 50 or so. I can't set anything in between. Everything looks right, except I'd like to set pen width from 1 to 6 pixels for example.

// ScaleTransform pen to the reverse of the graphics transform. This works.
float scaleX = gridRectangle_logical.Width / gridRectangle_device.Width;
float scaleY = gridRectangle_logical.Height / gridRectangle_device.Height;

Pen pen = new Pen(Color.Black, 4); // problem here.
pen.ScaleTransform(scaleX, scaleY);