Create and Cast Rectangle

Rectangle and RectangleF are one of a very useful features provided by IronDrawing which can be used for users to crop any image file. For customer who are using rectangles from System.Drawing.Rectangle or System.Drawing.RectangleF can also cast it to IronSoftware.Drawing.Rectangle and IronSoftware.Drawing.RectangleF using Cast method.

Create Rectangle & RectangleF

To create Rectangle, user can instantiate a new Rectangle and provide the X and Y coordinate, as well as the width and height measurement of the Rectangle in pixels as is Rectangle(10, 10, 50, 50). This is the same for RectangleF class: a sample Rectangle object is RectangleF(10.2F, 16.5F, 150F, 60F)

Cast Rectangle & RectangleF

To cast a IronSoftware.Drawing.Rectangle from System.Drawing.Rectangle or a IronSoftware.Drawing.RectangleF from System.Drawing.RectangleF, simply assign an instantiated System.Drawing.Rectangle or System.Drawing.RectangleF to a variable of type IronSoftware.Drawing.Rectangle or IronSoftware.Drawing.RectangleF, respectively.