V2/Cet/HW/Cet.HW.GDI/Geometries/Rectangle.cs
/// <summary>
/// Replaces this Rectangle with the intersection of itself and the specified Rectangle.
/// </summary>
/// <param name="rect">The Rectangle with which to intersect.</param>
Replaces this Rectangle with the intersection of itself and the specified Rectangle.
Replaces this Rectangle with the intersection of itself and the specified Rectangle .
public void Intersect(Rectangle rect)
        {
            if (this.Contains(rect))
            {
                int left = this.X > rect.X ? this.X : rect.X;
                int top = this.Y > rect.Y ? this.Y : rect.Y;
                int right1 = this.Right;
                int right2 = rect.Right;
                this._width = (right1 < right2 ? right1 : right2) - left;
                int bottom1 = this.Bottom;
                int bottom2 = rect.Bottom;
                this._height = (bottom1 < bottom2 ? bottom1 : bottom2) - top;
                this.X = left;
                this.Y = top;
            }
            else
            {
                this = new Rectangle();
            }
        }
public void Intersect ( Rectangle rect ) { if ( this . Contains ( rect ) ) { int left = this . X > rect . X ? this . X : rect . X ; int top = this . Y > rect . Y ? this . Y : rect . Y ; int right1 = this . Right ; int right2 = rect . Right ; this . _width = ( right1 < right2 ? right1 : right2 ) - left ; int bottom1 = this . Bottom ; int bottom2 = rect . Bottom ; this . _height = ( bottom1 < bottom2 ? bottom1 : bottom2 ) - top ; this . X = left ; this . Y = top ; } else { this = new Rectangle ( ) ; } }
Replaces this Rectangle with the intersection of itself and the specified Rectangle.
Replaces this Rectangle with the intersection of itself and the specified Rectangle .
rect
Rectangle
The Rectangle with which to intersect.
The Rectangle with which to intersect .