Re: Using Graphics.World when drawing



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
>


.



Relevant Pages

  • Re: brightness vb.net images
    ... such an image is due to dithering of pixels. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Capture and restore a rectangle of pixels FASTEST way
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... I have a rectangle *which has a border* of 3 pixels. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Check if area is empty
    ... You can iterate throught he pixels but if you think about it that implies ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Text width/height problem.
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... wrapped within a rectangle of WIDTH pixels? ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Video Mode 13h in windows XP ... impossible?
    ... out the fluff so they can concentrate on just plotting pixels without ... Actually, running full-screen and not in a window, Windows simply gets ... keys to the video display... ... (some cards do not come with VESA routines so Microsoft, I think, ...
    (alt.lang.asm)

Loading