using System.Drawing; namespace JD.Application.View.WindowLess { /// /// Adds functions to rectangle /// public static class DrawingExtensions { /// /// Returns the union of both rectangles, but does consider the empty rectangle as the neutral value. /// public static Rectangle Union(this Rectangle a, Rectangle b) { if (Equals(a, Rectangle.Empty)) { return b; } if (Equals(b, Rectangle.Empty)) { return a; } return Rectangle.Union(a, b); } /// /// Returns the union of both rectangles, but does consider the empty rectangle as the neutral value. /// public static RectangleF Union(this RectangleF a, RectangleF b) { if (Equals(a, RectangleF.Empty)) { return b; } if (Equals(b, RectangleF.Empty)) { return a; } return RectangleF.Union(a, b); } } }