Re: Using Graphics.World when drawing
- From: "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 10 Jul 2005 10:58:35 +0200
You can set the page units to millimeters. This gives each unit in world
space the value of 1 mm. Conversions to and from pixels are unneccesary.
Such conversion schemes can be a nightmare especially if you have to take
printing into account.
All zooming, panning and mouse input should be handled using a Matrix object
and you should simply paint all your object in their correct place in world
space coordinates.
See the GDI+ FAQ and Windows Forms Tips and Tricks for some ideas.
--
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.
<johannblake@xxxxxxxxx> wrote in message
news:1120982496.328054.117110@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I am wondering whether it is easy to setup a coordinate system for
> drawing (using GDI+) that uses meters (or any custom scaling for that
> matter). Currently, I need to convert from pixels to meters for
> scaling. This can sometimes get rather complex when you need to take
> scaling into account or other things like window resizing, scrolling,
> etc.
>
> There is a property called PageUnit which can be set to World. I could
> not find any examples that illustrate how to use this "World" mode. Can
> anyone show me a snippet of code how to setup the client drawing area
> to work with meters?
>
> In old VB, it was possible to create a custom scale. If I said that the
> client area is 100 x 100, my app simply interpreted that as being
> whatever I chose to define as the units. So if I drew a line 10 units
> long horizontally (and assuming that the scale factor was set to one),
> it would draw a line 1/10th the width of my client area. I am looking
> for something along this line of simplicity.
>
> Thanks for any help
> Johann Blake
>
.
- Follow-Ups:
- Re: Using Graphics.World when drawing
- From: johannblake@xxxxxxxxx
- Re: Using Graphics.World when drawing
- References:
- Using Graphics.World when drawing
- From: johannblake@xxxxxxxxx
- Using Graphics.World when drawing
- Prev by Date: Re: Source function for browser
- Next by Date: Re: Excel
- Previous by thread: Using Graphics.World when drawing
- Next by thread: Re: Using Graphics.World when drawing
- Index(es):
Relevant Pages
|
Loading