+3  A: 

Assuming you're rotating clockwise from 12 o'clock, your new x-coordinate will be:

sin(130) * 200 = 153 + original x-coordinate

And your new y-coordinate will be

cos(130) * 200 = -129 + original y-coordinate (assuming negative 'y' is down)

As below, note that in C#, for example, sin and cos take radians, not degrees - multiply by Math.PI/180 to get the value in radians first.

Andy Mikula
It is almost working, with your equations.But it is moving backwards, instead of forward. What should I change in the equation ?
Andreas Grech
And by the x and y variables, you mean the starting points ?
Andreas Grech
Yes - the starting points.If your 'y' coordinates get larger as you move down the page, you may have to multiply the result of cos(130)*200 by -1.
Andy Mikula
That (* -1) solved it. Thanks.
Andreas Grech
A: 

look at the TransformToVisual if you have the coordinate of your object from Visual A origin and you want the coordinates of your object from Visual B origin, then you do

   var transformation = A.TransformToVisual(B);

you can cast transformation from GeneralTransform to Transform if needed. Then you can use Transform method of your GeneralTransform object.

Nicolas Dorier
But in this case, B doesn't exist because the canvas is not moving to another object. But thanks for the mention of TransformToVisual; didn't know about it, and I will use it for something else.
Andreas Grech
In this case B is the object that you are moving whose coordinates are (300,400) in the canvas.
Nicolas Dorier
and what is A then ?
Andreas Grech
Sorry, I meant B is your windows, and A the square (what you call Canvas). See my other answer.
Nicolas Dorier
+2  A: 

You can use cos and sin to work out the amount of movement in the x and y coordinates. This is based on the unit circle.

The unit circle has angles starting from the right side, going anti-clockwise. So in the unit circle your angle of 130 degrees is actually 320 degrees.

actualAngle = 90 - 130 = -40 
(which is the same as 320 degrees when used in sin/cos)

The other thing to note is that the cos and sin functions are using radians instead of degrees.

angleInRadians = 320 * pi / 180 (about 5.59)
x = cos(angleInRadians) * 200 + 300 (about 453.21)
y = sin(angleInRadians) * 200 + 400 (about 271.44)
Cameron MacFarland
It's almost working, but the y coordinate is going up, instead of down. What should I change from the equation?
Andreas Grech
Also, how do I derive the proper Unit Circle angle ? like you derived 320 from 130. as in, what formula should I use ?
Andreas Grech
This is for +y going up.
Cameron MacFarland
A: 

I will detail how you can do without using Mathematics :

Note that, I don't try what I'm saying, so maybe there is some mistakes.

I will call the square you are moving Visual B,

I will call the container of the square Visual A.

Now, you want to be able to do a translation of B from B origin to B', and retrieve B' coordinate from A origin.

If your translation is (200,0), then the coordinate of B' from B origin is (200,0). You want these coordinates from A origin. So you have to do.

var transform = B.TransformToVisual(A);
var pointFromAOrigin  = transform.Transform(new Point(200,0));

pointFromAOrigin reflect what you want.

Nicolas Dorier