using System;
|
using System.Collections.Generic;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
|
namespace IStation.Extensions
|
{
|
/// <summary>
|
/// Point 拓展
|
/// </summary>
|
public static class PointExtension
|
{
|
/// <summary>
|
/// 获取矩形
|
/// </summary>
|
/// <param name="p1"></param>
|
/// <param name="p2"></param>
|
/// <returns></returns>
|
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);
|
}
|
}
|
}
|