CGRect CGRect Struct
Definition
Structure defining a rectangle in terms of location and size.
[System.Serializable]
public struct CGRect : IEquatable<CoreGraphics.CGRect>
type CGRect = struct
 Inheritance
 Attributes
 Implements
Remarks
CGRects structures define a rectangle using floating point values of type nfloat and are defined using an initial location (X,Y) as well as a size (Width, Height).
You can save the CGRect into an NSDictionary by calling the ToDictionary() method. You can also get an CGRect out a serialized dictionary by using the TryParse(NSDictionary, CGRect) method.
Constructors
CGRect(CGPoint, CGSize) CGRect(CGPoint, CGSize) 
Initializes a CGRect structure from a rectangle and a size parameters. 
CGRect(Double, Double, Double, Double) CGRect(Double, Double, Double, Double) 
Initializes a CGRect structure from a double precision floating point values, with potential truncation on 32 bit systems. 
CGRect(nfloat, nfloat, nfloat, nfloat) CGRect(nfloat, nfloat, nfloat, nfloat) 
Initializes a CGRect structure from native floating point values. 
CGRect(Single, Single, Single, Single) CGRect(Single, Single, Single, Single) 
Constructs a rectangle with the specified dimensions. 
Fields
Empty Empty 
Represents a CGRect structure with its properties left uninitialized. 
Properties
Bottom Bottom 
Gets the ycoordinate that is the sum of the Y and Height property values of this CGRect structure. 
Height Height 
Gets or sets the height of this CGRect structure. 
Infinite Infinite 
Gets an infinitely large rectangle. 
IsEmpty IsEmpty 
Tests whether all numeric properties of this CGRect have values of zero. 
Left Left 
Gets the xcoordinate of the left edge of this CGRect structure. 
Location Location 
Gets or sets the coordinates of the upperleft corner of this CGRect structure. 
Null Null 
Gets an invalid, or null, rectangle. 
Right Right 
Gets the xcoordinate that is the sum of X and Width property values of this CGRect structure. 
Size Size 
Gets or sets the size of this CGRect. 
Top Top 
The Y coordinate of the top of the rectangle. 
Width Width 
Gets or sets the width of this CGRect structure. 
X X 
Gets or sets the xcoordinate of the upperleft corner of this CGRect structure. 
Y Y 
Gets or sets the ycoordinate of the upperleft corner of this CGRect structure. 
Methods
Contains(CGPoint) Contains(CGPoint) 
Determines if the specified point is contained within this CGRect structure. 
Contains(CGRect) Contains(CGRect) 
Determines if the rectangular region represented by 
Contains(Double, Double) Contains(Double, Double) 

Contains(nfloat, nfloat) Contains(nfloat, nfloat) 
Determines if the specified point is contained within this CGRect structure. 
Contains(Single, Single) Contains(Single, Single) 
Determines if the specified point is contained within this CGRect structure. 
Equals(Object) Equals(Object) 
Tests whether 
Equals(CGRect) Equals(CGRect) 
Tests whether 
FromLTRB(nfloat, nfloat, nfloat, nfloat) FromLTRB(nfloat, nfloat, nfloat, nfloat) 
Creates a CGRect structure with the specified edge locations. 
GetHashCode() GetHashCode() 
Returns the hash code for this CGRect structure. For information about the use of hash codes, see 
Inflate(CGSize) Inflate(CGSize) 
Enlarges this CGRect by the specified amount. 
Inflate(Double, Double) Inflate(Double, Double) 
Increases the size of the rectangle by adding the specified amounts along both directions of each axis. 
Inflate(nfloat, nfloat) Inflate(nfloat, nfloat) 
Enlarges this CGRect by the specified amount. 
Inflate(Single, Single) Inflate(Single, Single)  
Inflate(CGRect, nfloat, nfloat) Inflate(CGRect, nfloat, nfloat) 
Creates and returns an enlarged copy of the specified CGRect structure. The copy is enlarged by the specified amount. The original CGRect structure remains unmodified. 
Intersect(CGRect) Intersect(CGRect) 
Replaces this CGRect with the intersection of itself and the specified CGRect. 
Intersect(CGRect, CGRect) Intersect(CGRect, CGRect) 
Returns a third CGRect structure that represents the intersection of two other CGRect structures. If there is no intersection, an empty CGRect is returned. 
IntersectsWith(CGRect) IntersectsWith(CGRect) 
Determines if this rectangle intersects with 
Offset(CGPoint) Offset(CGPoint) 
Adjusts the location of this rectangle by the specified amount. 
Offset(Double, Double) Offset(Double, Double) 
Adjusts the location of this rectangle by the specified amount. 
Offset(nfloat, nfloat) Offset(nfloat, nfloat) 
Adjusts the location of this rectangle by the specified amount. 
Offset(Single, Single) Offset(Single, Single) 
Adjusts the location of this rectangle by the specified amount. 
ToDictionary() ToDictionary() 
Serializes the state of the rectangle into an NSDictionary. 
ToString() ToString() 
Gets the ycoordinate of the top edge of this CGRect structure. 
TryParse(NSDictionary, CGRect) TryParse(NSDictionary, CGRect)  
Union(CGRect, CGRect) Union(CGRect, CGRect) 
Gets a CGRect structure that contains the union of two CGRect structures. 
Operators
Equality(CGRect, CGRect) Equality(CGRect, CGRect) 
Tests whether two CGRect structures have equal location and size. 
Explicit(CGRect to Rectangle) Explicit(CGRect to Rectangle)  
Explicit(CGRect to RectangleF) Explicit(CGRect to RectangleF) 
Converts a CGRect to a RectangleF. 
Implicit(RectangleF to CGRect) Implicit(RectangleF to CGRect) 
Implicitly converts a RectangleF to a CGRect. 
Implicit(Rectangle to CGRect) Implicit(Rectangle to CGRect)  
Inequality(CGRect, CGRect) Inequality(CGRect, CGRect) 
Peforms a value comparison of two rectangles. 