How to resize rectangle?
-
Hi All, I am drawing rectangle on the form. (VC#) I am able to resize the rectangle when rectangle is at zero degrees. For example, if i want to resize top right: rect.Y = mousepoint.Y; rect.Height += OriginalRect.Top - mousepoint.Y; rect.Width += mousepoint.X - OriginalRect.Right; whereas 'rect' is rectangle after resize, 'mousepoint' is mouse pointer while mouse move. But When i rotate rectangle at, say 30 degrees, I have the problem, the above code won't work. I need to change x, y, width and height. How to do it? I just want a clue. I want to make sure that i am using Visual Studio 2005. This app is NOT WPF. Thanks in advance.
-
Hi All, I am drawing rectangle on the form. (VC#) I am able to resize the rectangle when rectangle is at zero degrees. For example, if i want to resize top right: rect.Y = mousepoint.Y; rect.Height += OriginalRect.Top - mousepoint.Y; rect.Width += mousepoint.X - OriginalRect.Right; whereas 'rect' is rectangle after resize, 'mousepoint' is mouse pointer while mouse move. But When i rotate rectangle at, say 30 degrees, I have the problem, the above code won't work. I need to change x, y, width and height. How to do it? I just want a clue. I want to make sure that i am using Visual Studio 2005. This app is NOT WPF. Thanks in advance.