System.Drawing.Rectangle.FromLTRB C# (CSharp) Method

FromLTRB() public static method

Creates a new with the specified location and size.
public static FromLTRB ( int left, int top, int right, int bottom ) : Rectangle
left int
top int
right int
bottom int
return Rectangle
        public static Rectangle FromLTRB(int left, int top, int right, int bottom) =>
            new Rectangle(left, top, right - left, bottom - top);

Same methods

Rectangle::FromLTRB ( int left, int top, int right, int bottom ) : System.Drawing.Rectangle

Usage Example

Beispiel #1
0
        /// <summary>
        /// Return a rectangle of our coordinates
        /// </summary>
        /// <param name="topLeft"></param>
        /// <param name="bottomRight"></param>
        /// <returns></returns>
        public Rectangle ConvertRectangle(PointF topLeft, PointF bottomRight)
        {
            Point topLeftXY     = ConvertPoint(topLeft);
            Point bottomRightXY = ConvertPoint(bottomRight);

            return(Rectangle.FromLTRB(Math.Min(topLeftXY.X, bottomRightXY.X), Math.Min(topLeftXY.Y, bottomRightXY.Y), Math.Max(topLeftXY.X, bottomRightXY.X), Math.Max(topLeftXY.Y, bottomRightXY.Y)));
        }
All Usage Examples Of System.Drawing.Rectangle::FromLTRB