I have two points created, like a line. I want to convert it as a rectangle.
How should I do it?
For example this is how I draw the line. But I want it to be a Rectangle
private PointF start, end;
protected override void OnMouseDown(MouseEventArgs e)
{
start.X = e.X;
start.Y = e.Y;
}
protected override void OnMouseUp(MouseEventArgs e)
{
end.X = e.X;
end.Y = e.Y;
Invalidate();
}
How about:
Basically this makes sure you really do present the upper-left corner as the “start”, even if the user has created a line from the bottom-left to top-right corners.