V2/Cet/HW/Cet.HW.GDI/Geometries/Rectangle.cs
/// <summary>
/// Gets a Rectangle structure that contains the union of two Rectangle structures.
/// </summary>
/// <param name="a">A rectangle to union.</param>
/// <param name="b">A rectangle to union.</param>
/// <returns>A Rectangle structure that bounds the union of the two Rectangle structures.</returns>
Gets a Rectangle structure that contains the union of two Rectangle structures.
Gets a Rectangle structure that contains the union of two Rectangle structures .
public static Rectangle Union(
            Rectangle a,
            Rectangle b)
        {
            if (a.IsEmpty || b.IsEmpty)
            {
                return new Rectangle();
            }
            else
            {
                int left = a.Left < b.Left ? a.Left : b.Left;
                int top = a.Top < b.Top ? a.Top : b.Top;
                int right1 = a.Right;
                int right2 = b.Right;
                int width = (right1 > right2 ? right1 : right2) - left;
                int bottom1 = a.Bottom;
                int bottom2 = b.Bottom;
                int height = (bottom1 > bottom2 ? bottom1 : bottom2) - top;
                return new Rectangle(
                    left, 
                    top, 
                    width, 
                    height);
            }
        }
public static Rectangle Union ( Rectangle a , Rectangle b ) { if ( a . IsEmpty || b . IsEmpty ) { return new Rectangle ( ) ; } else { int left = a . Left < b . Left ? a . Left : b . Left ; int top = a . Top < b . Top ? a . Top : b . Top ; int right1 = a . Right ; int right2 = b . Right ; int width = ( right1 > right2 ? right1 : right2 ) - left ; int bottom1 = a . Bottom ; int bottom2 = b . Bottom ; int height = ( bottom1 > bottom2 ? bottom1 : bottom2 ) - top ; return new Rectangle ( left , top , width , height ) ; } }
Gets a Rectangle structure that contains the union of two Rectangle structures.
Gets a Rectangle structure that contains the union of two Rectangle structures .
A Rectangle structure that bounds the union of the two Rectangle structures.
A Rectangle structure that bounds the union of the two Rectangle structures .
a
Rectangle
A rectangle to union.
A rectangle to union .
b
Rectangle
A rectangle to union.
A rectangle to union .