Re: Pen width difficult to control with scaled graphics
- From: "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 22 Jan 2009 19:49:58 +0100
This is a well known problem with GDI+
There doesn't seem to be a workaround except drawing some of the graphics at scale and then others unscaled using the matrix but scaled manually.
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Paul" <this@xxxxxxxxxx> wrote in message news:%23g0akn0XJHA.5828@xxxxxxxxxxxxxxxxxxxxxxx
I'm using System.Drawing.
My logical drawing area is 10000f x 10000f. I am drawing a graph of
continuous meter readings using Graphics.DrawLines. How can you set a pen
width of 4 pixels? I am completely baffled. Either I get 1 pixel width or
it snaps up to about 50 pixels. There is no fine control over the pen
width. I am inverting the pen scaling using the inverse of the graphics
transform (required for constant width lines).
The funny thing is that when my logical units are 10000f x 100f I can
control the pen width very nicely, and by inverting the graphics transform
the line drawn is uniform in x and y directions, which is what you would
want. I would use this scaling, but there is some strange rounding error
and my curves have annoying step jumps -- I am using float valued APIs and
I was expecting all my win32 rounding issues a thing of the past. By
increasing the vertical scale by x100 I get smooth curves, but the pen is
out of control then.
Did any of this make sense?
.
- Prev by Date: DrawImage anomaly with small bitmaps
- Next by Date: Re: DrawImage anomaly with small bitmaps
- Previous by thread: DrawImage anomaly with small bitmaps
- Next by thread: RE: Image.FromStream - Invalid Parameter Used
- Index(es):
Relevant Pages
|