You can use the delta to resize the shape if it is rotated. The only thing you need to do is also rotate the mousemovement. As you can see:
vectorrotate http://s1.directupload.net/images/140313/ajrbvy55.jpg
The movement of the mouse from source to location describes a two-dimensional vector. You can rotate this vector mathematically using this formula:
x '= cos (theta) * x - sin (theta) * y
y '= sin (theta) * x + cos (theta) * y
where x / y is the current location of the mouse relative to the beginning of the resizing and theta is the rotation angle that can be found in the RotateTransform (Angle-Property) of the form. At the moment, I donโt know for sure whether to use this function, because the vector should rotate in the opposite direction.
You can select x '/ y' to calculate the deltas and resize the shape as if it were not rotated.
I have not implemented this myself. This is just a general idea. Maybe I can serve with a little code if you try this and give feedback or ask the problem in more detail or update your question with some code.
Application:
Changing the shape with the delta should be easy if you can access the width and height properties of the form. You simply add / subtract x-delta width to / from and / or add / subtract y-delta to / from height, depending on the capture point. This does not affect the position of the form inside the canvas. Perhaps you need to customize the Canvas.Left / Canvas.Top-Form Property. That is, if the user captures the upper left point and resizes it to the left / up, you must also subtract the delta from the left and upper shape. Otherwise, it will expand to the right / down.
Martin tausch
source share