From 545b3728f1ea476ca8595e45be615398d44bdeb6 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Wed, 27 Oct 2021 07:42:10 -0400 Subject: [PATCH] convenience method to create a Rectangle from Left/Top/Right/Bottom coordinates --- MBS.Framework/Drawing/Rectangle.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/MBS.Framework/Drawing/Rectangle.cs b/MBS.Framework/Drawing/Rectangle.cs index b567f13..54c3e43 100644 --- a/MBS.Framework/Drawing/Rectangle.cs +++ b/MBS.Framework/Drawing/Rectangle.cs @@ -78,6 +78,24 @@ namespace MBS.Framework.Drawing return rect; } + /// + /// Creates a from left, top, right, bottom coordinates. + /// + /// The ltrb. + /// Bounding box l. + /// Bounding box t. + /// Bounding box r. + /// Bounding box b. + public static Rectangle FromLTRB(double left, double top, double right, double bottom) + { + Rectangle rect = new Rectangle(); + rect.X = left; + rect.Y = top; + rect.Right = right; + rect.Bottom = bottom; + return rect; + } + /// /// Normalize this instance. ///