Struct RectangleF

RectangleF structure

Stores a set of four floating-point numbers that represent the location and size of a rectangle. For more advanced region functions, use a Region object.

public struct RectangleF : IEquatable<RectangleF>

Constructors

NameDescription
RectangleF(PointF, SizeF)Initializes a new instance of the RectangleF structure with the specified location and size.
RectangleF(float, float, float, float)Initializes a new instance of the RectangleF structure with the specified location and size.

Properties

NameDescription
Bottom { get; }Gets the y-coordinate that is the sum of Y and Height of this RectangleF structure.
Height { get; set; }Gets or sets the height of this RectangleF structure.
IsEmpty { get; }Gets a value indicating whether the Width or Height property of this RectangleF has a value of zero.
Left { get; }Gets the x-coordinate of the left edge of this RectangleF structure.
Location { get; set; }Gets or sets the coordinates of the upper-left corner of this RectangleF structure.
Right { get; }Gets the x-coordinate that is the sum of X and Width of this RectangleF structure.
Size { get; set; }Gets or sets the size of this RectangleF.
Top { get; }Gets the y-coordinate of the top edge of this RectangleF structure.
Width { get; set; }Gets or sets the width of this RectangleF structure.
X { get; set; }Gets or sets the x-coordinate of the upper-left corner of this RectangleF structure.
Y { get; set; }Gets or sets the x-coordinate of the upper-left corner of this RectangleF structure.

Methods

NameDescription
static FromLTRB(float, float, float, float)Creates a RectangleF structure with upper-left corner and lower-right corner at the specified locations.
static Inflate(RectangleF, float, float)Creates and returns an inflated copy of the specified RectangleF structure. The copy is inflated by the specified amount. The original rectangle remains unmodified.
static Intersect(RectangleF, RectangleF)Returns a RectangleF structure that represents the intersection of two rectangles. If there is no intersection, and empty RectangleF is returned.
static Union(RectangleF, RectangleF)Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.
Contains(PointF)Determines if the specified point is contained within this RectangleF structure.
Contains(RectangleF)Determines if the rectangular region represented by rect is entirely contained within this RectangleF structure.
Contains(float, float)Determines if the specified point is contained within this RectangleF structure.
override Equals(object)Determines whether the specified Object, is equal to this instance.
Equals(RectangleF)Tests whether other RectangleF structure has the same location and size of this RectangleF structure.
override GetHashCode()Returns a hash code for this instance.
Inflate(SizeF)Inflates this RectangleF by the specified amount.
Inflate(float, float)Inflates this RectangleF structure by the specified amount.
Intersect(RectangleF)Replaces this RectangleF structure with the intersection of itself and the specified RectangleF structure.
IntersectsWith(RectangleF)Determines if this rectangle intersects with rect.
Offset(PointF)Adjusts the location of this rectangle by the specified amount.
Offset(float, float)Adjusts the location of this rectangle by the specified amount.
override ToString()Converts the attributes of this Rectangle to a human readable string.
operator ==Tests whether two RectangleF structures have equal location and size.
implicit operatorConverts the specified Rectangle structure to a RectangleF structure.
operator !=Tests whether two RectangleF structures differ in location or size.

Fields

NameDescription
static readonly EmptyRepresents an instance of the RectangleF class with its members uninitialized.

See Also