I use GDI functions to render vector data for many years,even after migration to C# and dotNet,I still use GDI libraries because I found GDI much faster than GDI+ in vector rendering.
Now I have stuck in a problem where I have to use GDI+ and face a problem.My vector coordinates are in real world and according to a lot of snippet code in the net,I call some functions of graphics object to make a right transformation but still my form doesn't paint anything.I'm sure there is a problem with my code,so please let me know what's wrong with this code that does not paint a simple line.it's a windows form Paint function which has been overriden.
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
float X_ExtentInRealWorld = 757600-757540;
float Y_ExtentInRealWorld = 3170320-3170270;
float clientW = this.ClientRectangle.Width;
float clientH = this.ClientRectangle.Height;
float xyScale = Math.Min(clientH / Y_ExtentInRealWorld, clientW / X_ExtentInRealWorld);
g.TranslateTransform(757540, 3170270);
g.ScaleTransform(xyScale, xyScale, MatrixOrder.Prepend);
PointF[] dumy = new PointF[2];
dumy[0].X = 757541.459335231F;
dumy[0].Y = 3170320.50846391F;
dumy[1].X = 757599.892618402F;
dumy[1].Y = 3170319.99492757F;
Pen pn = new Pen(Color.Black);
pn.Width =0;
g.DrawLines(pn, dumy);
}
if I use TransformPoints to convert back points from World to page space,I see that converted points are all in client area of form:
g.TransformPoints(CoordinateSpace.World, CoordinateSpace.Page, dumy);
any help or guid lines is highly appreciated
Regards