How to move and zoom an image?
-
If you have used Autocad , you must know how convenient it is to use "pan",Zoom in realtime. I am wondering how can we move an image inside a picture box, after zoom in or our. Can Anyone help? jim:laugh:
-
If you have used Autocad , you must know how convenient it is to use "pan",Zoom in realtime. I am wondering how can we move an image inside a picture box, after zoom in or our. Can Anyone help? jim:laugh:
Look at Graphics.Transform, should be all you need :) ie
float scale = percentagezoom/100f;
g.Transform = new Matrix(scale,0,0,scale, xoffest, yoffset);xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
-
Look at Graphics.Transform, should be all you need :) ie
float scale = percentagezoom/100f;
g.Transform = new Matrix(scale,0,0,scale, xoffest, yoffset);xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
thank ya leppie, after several hour , I got it worked, //////////////////// everyone is my teacher
-
Look at Graphics.Transform, should be all you need :) ie
float scale = percentagezoom/100f;
g.Transform = new Matrix(scale,0,0,scale, xoffest, yoffset);xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
Hi, I'm quite new to C# especially when using GDI+. I saw the solution for zooming an image, but I didn't manage to zoom. I couldn't quite understand what the parameters in "new Matrix(scale,0,0,scale, xoffest, yoffset);" mean I think :) In order to zoom my image by 25% I implemented your code in the following way: float scale = 25f/100f; pictureBox.Image.Save("OriginalImage.png",ImageFormat.Png); Graphics g = Graphics.FromImage(pictureBox.Image); g.Transform = new Matrix(scale,0,0,scale, 0, 0); pictureBox.Image.Save("ResizedImage.png", ImageFormat.Png); pictureBox.Image = Image.FromFile("ResizedImage.png"); //to load the new image What am I doing wrong please? Thanks A Lot! C.N.