Name

RectangleF

Synopsis

This value type is the real equivalent of the integer-based Rectangle. Again, it defines a rectangular region of a 2D surface. It offers all the basic facilities of the Rectangle structure, and a conversion operator to convert from a Rectangle.

As with the Point / PointF pair, there is no intrinsic performance advantage in using the integer Rectangle, as all the Graphics painting methods are implemented in terms of the real version anyway (in the first release of the framework).

The same rendering issues also apply as for Rectangle-based shapes if you are not aligned to the pixel boundaries of the target device.


public struct RectangleF {

// Public Constructors

   public RectangleF(PointF location, SizeF size);

   public RectangleF(float x, float y, float width, float height);

// Public Static Fields

   public static readonly RectangleF Empty;  // = {X=0,Y=0,Width=0,Height=0}

                  // Public Instance Properties

   public float Bottom{get; }

   public float Height{set; get; }

   public bool IsEmpty{get; }

   public float Left{get; }

   public PointF Location{set; get; }

   public float Right{get; }

   public SizeF Size{set; get; }

   public float Top{get; }

   public float Width{set; get; }

   public float X{set; get; }

   public float Y{set; get; }

// Public Static Methods

   public static RectangleF FromLTRB(float left, float top, float right, float bottom);

   public static RectangleF Inflate(RectangleF rect, float x, float y);

   public static RectangleF Intersect(RectangleF a, RectangleF b); public static RectangleF ...

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.