I'm making a paint program for my collage project. What I want to do is this
S is a center point that is constant A,B,C,D - one of this is one of mouse location. Normally I click on point A then drag it to point C and a square will be created with start point A and width (C.X-A.X) and height (C.Y-A.Y). But I need it when I click on point S and drag it to Point C it should create a square with Point A as start point, width and height. All of those I need to calculate from Center point S and one point (c for example). This is the code that I have
(int)Math.Min(center.X, mouse.X) - Math.Abs(mouse.X - center.X), (point A.X)
(int)Math.Min(center.Y, mouse.Y) - Math.Abs(mouse.Y - center.Y), (point A.Y)
(int)Math.Abs(endPoint.X - startPoint.X) * 2, (width)
(int)Math.Abs(endPoint.Y - startPoint.Y) * 2)); (height)
This works if I go from S to C, but when I go, for example, from point S to point A than point C of the square stays in place while point S and A(double the length from S to C) moves.
I hope You understand me. :D
Thank You in advance.