Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to transform mouse coordinates by image coordinates, by this code i am getting correct coordinates of image.
C#
Bitmap resizeBitmap = new Bitmap("image.jpg");
Graphics g = Graphics.FromImage(resizeBitmap);

float scaleFactorX = (float)resizewidth / (float)originalwidth;
float scaleFactorY = (float)resizeheight / (float)originalheight;

g.TranslateTransform((float)resizewidth / 2, (float)resizeheight / 2);
g.ScaleTransform(scaleFactorX, scaleFactorY);
g.RotateTransform(angle1);
g.TranslateTransform(-(float)originalwidth / 2, -(float)originalheight / 2);
g.TransformPoints(System.Drawing.Drawing2D.CoordinateSpace.World, System.Drawing.Drawing2D.CoordinateSpace.Device, point);

But i want to know that how can i do the same thing by using matrix class. and i also want to know that what is the use of Rectangle object in transformation. Thanking you all in advance.
Posted
Updated 27-Jun-13 0:37am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900