F
Fabio
Hi all!
A question about transformations.
Let's have this piece of code that transforms the coordinates of the
Graphics object:
---------
Graphics g = e.Graphics;
Matrix m = g.Transform;
m.RotateAt(45, new Point(100, 100));
g.Transform = m;
g.DrawRectangle(Pens.Blue, 50, 50, 100, 100);
---------
This works, ok.
But let's say that I need to get if a point falls into the transformed
rectangle, i.e.:
Rectangle r = new Rectangle(50, 50, 100, 100);
Console.Write(r.Contains(55, 55);
Obviously, this fails, since the point is computed with the "normal"
coordinates.
There is a way to transform also the coordinates of the control surface?
Thanks!
A question about transformations.
Let's have this piece of code that transforms the coordinates of the
Graphics object:
---------
Graphics g = e.Graphics;
Matrix m = g.Transform;
m.RotateAt(45, new Point(100, 100));
g.Transform = m;
g.DrawRectangle(Pens.Blue, 50, 50, 100, 100);
---------
This works, ok.
But let's say that I need to get if a point falls into the transformed
rectangle, i.e.:
Rectangle r = new Rectangle(50, 50, 100, 100);
Console.Write(r.Contains(55, 55);
Obviously, this fails, since the point is computed with the "normal"
coordinates.
There is a way to transform also the coordinates of the control surface?
Thanks!