DekGenius.com
[ Team LiB ] Previous Section Next Section

RectangleFserializable

System.Drawing (system.drawing.dll)struct

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 Union(RectangleF a, RectangleF b);
   public static bool operator !=(RectangleF left, RectangleF right);
   public static bool operator ==(RectangleF left, RectangleF right);
   public static implicit operator RectangleF(Rectangle r);
// Public Instance Methods
   public bool Contains(PointF pt);
   public bool Contains(RectangleF rect);
   public bool Contains(float x, float y);
   public override bool Equals(object obj);  // overrides ValueType
   public override int GetHashCode();  // overrides ValueType
   public void Inflate(float x, float y);
   public void Inflate(SizeF size);
   public void Intersect(RectangleF rect);
   public bool IntersectsWith(RectangleF rect);
   public void Offset(PointF pos);
   public void Offset(float x, float y);
   public override string ToString();  // overrides ValueType
}

Hierarchy

System.Object System.ValueType RectangleF

Returned By

System.Drawing.Drawing2D.GraphicsPath.GetBounds(), System.Drawing.Drawing2D.LinearGradientBrush.Rectangle, System.Drawing.Drawing2D.PathGradientBrush.Rectangle, Graphics.{ClipBounds, VisibleClipBounds}, Image.GetBounds(), Region.{GetBounds(), GetRegionScans()}

Passed To

Multiple types

    [ Team LiB ] Previous Section Next Section