System.Drawing.GraphicsUtil.IncludePointX C# (CSharp) Method

IncludePointX() public static method

Checks if x-coordinate is contained within the RectangleF structure and extends rectangle bounds if neccessary to include the point.
public static IncludePointX ( RectangleF &rect, float xToInclude ) : void
rect RectangleF /// RectangleF to check. ///
xToInclude float /// x-coordinate to include. ///
return void
        public static void IncludePointX(ref RectangleF rect, float xToInclude)
        {
            if (xToInclude < rect.X) {
                rect.Width = rect.Right - xToInclude;
                rect.X = xToInclude;
            }
            else if (xToInclude > rect.Right)
                rect.Width = xToInclude - rect.X;
        }