c# drawing library calculate ranges and midpoints to draw and circle
问题 Basically i have a menu that user choose the shape wanted to be drawn, then the user click on two points, between those two points the chosen shape will be drawn. I did the Square which is calculated this way // calculate ranges and mid points xDiff = oppPt.X - keyPt.X; yDiff = oppPt.Y - keyPt.Y; xMid = (oppPt.X + keyPt.X) / 2; yMid = (oppPt.Y + keyPt.Y) / 2; // draw square g.DrawLine(blackPen, (int)keyPt.X, (int)keyPt.Y, (int)(xMid + yDiff / 2), (int)(yMid - xDiff / 2)); g.DrawLine(blackPen,