Rectangle Struct
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Struct defining a rectangle, using doubles.
[System.Diagnostics.DebuggerDisplay("X={X}, Y={Y}, Width={Width}, Height={Height}")]
[Xamarin.Forms.TypeConverter(typeof(Xamarin.Forms.RectangleTypeConverter))]
public struct Rectangle
type Rectangle = struct
- Inheritance
-
System.ValueTypeRectangle
- Attributes
-
System.Diagnostics.DebuggerDisplayAttribute TypeConverterAttribute
Remarks
Application developers should be aware of the limits of floating-point representations, specifically the possibility of incorrect comparisons and equality checks for values with small differences. David Goldberg's paper What Every Computer Scientist Should Know About Floating-Point Arithmetic describes the issues excellently.
Constructors
Rectangle(Double, Double, Double, Double) |
Creates a new Rectangle object with its top left corner at ( |
Rectangle(Point, Size) |
Creates a new Rectangle object with its top left corner at |
Fields
Zero |
The Rectangle at {0,0} whose Size is {0,0}. |
Properties
Bottom |
The bottom of the Rectangle. |
Center | |
Height |
Extent along the Y axis. |
IsEmpty |
Whether |
Left |
The position of the Rectangle on the X axis. |
Location | |
Right |
The furthest extent along the X axis. |
Size |
The extent of the Rectangle along its X and Y axes. |
Top |
The top of the Rectangle. |
Width |
The extent of this Rectangle along the X axis. |
X |
The position of this Rectangle on the X axis. |
Y |
The position of this Rectangle on the Y axis. |
Methods
Contains(Double, Double) |
Whether the point described by |
Contains(Point) |
Whether the |
Contains(Rectangle) |
Whether |
Deconstruct(Double, Double, Double, Double) | |
Equals(Object) |
Whether an System.Object is a Rectangle and has exactly the same values as |
Equals(Rectangle) |
Whether a Rectangle has exactly the same values as |
FromLTRB(Double, Double, Double, Double) |
Factory method to create a Rectangle from |
GetHashCode() |
The hashcode for the Rectangle. |
Inflate(Double, Double) |
Creates a Rectangle whose borders are inflated in every direction. |
Inflate(Size) |
Creates a Rectangle whose borders are inflated in every direction. |
Intersect(Rectangle, Rectangle) |
A new Rectangle that is the intersection of |
Intersect(Rectangle) |
A new Rectangle that is the intersection of |
IntersectsWith(Rectangle) |
Whether |
Offset(Double, Double) | |
Offset(Point) | |
Round() |
Returns a new Rectangle whose values have been rounded to their nearest integral value. |
ToString() |
A human-readable description of the Rectangle. |
Union(Rectangle, Rectangle) |
A new Rectangle whose bounds cover the union of |
Union(Rectangle) |
A new Rectangle whose bounds cover the union of |
Operators
Equality(Rectangle, Rectangle) |
Whether two Rectangles have equal values. |
Implicit(Rect to Rectangle) | |
Implicit(Rectangle to Rect) | |
Inequality(Rectangle, Rectangle) |
Whether two Rectangles have unequal values. |