using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; namespace IStation.Extensions { /// /// Point 拓展 /// public static class PointExtension { /// /// 获取矩形 /// /// /// /// public static Rectangle GetRectangle(this Point p1, Point p2) { int x = p1.X < p2.X ? p1.X : p2.X; int y = p1.Y < p2.Y ? p1.Y : p2.Y; int width = Math.Abs(p1.X - p2.X); int height = Math.Abs(p1.Y - p2.Y); return new Rectangle(x, y, width, height); } } }