You should note that the default orientation or direction of graphics in most drawing systems is from top of display to the bottom of the display. To compensate for this, you need to know the intended height of your viewing area, and then subtract your coordinates from that height. This will reverse the orientation, and set your figures relative to the bottom of the viewing area.
Let s say you have two points specified as <x,y> and a viewport that is 300 (w) x 200 (h).
{{0, 0}, {100, 200}}
When drawing in the viewing area, <x, y> will get mapped to <x, 200-y>. This gives us the following points.
{{0, 200}, {100, 0}}
There are also mechanisms to switch the mapping mode to Cartesian style coordinates, which will probably match your source data, but is usually avoided because it will remap everything else that has already compensated for the default orientation.
The SetMapMode() function in Windows can be used for this purpose if this is what you really wish.
SetMapMode() @ MSDN
Here s the P/Invoke signature of the function. (from
pinvoke.net: setmapmode (gdi32) )
[DllImport("gdi32.dll")]
static extern int SetMapMode(IntPtr hdc, int fnMapMode);
edit:
There s one more way to accomplish this, which I personally haven t tried.
Graphics.TransformPoints Method @ MSDN
This allows you to specify coordinate systems, and the Graphics object will do the mapping for you. In your case, you may wish to call it with CoordinateSpace.World or CoordinateSpace.Page as the first argument, and CoordinateSpace.Device as the second.