CGRect 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.
Structure defining a rectangle in terms of location and size.
[System.Serializable]
public struct CGRect : IEquatable<CoreGraphics.CGRect>
type CGRect = struct
 Inheritance

CGRect
 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) 
Initializes a CGRect structure from a rectangle and a size parameters. 
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) 
Initializes a CGRect structure from native floating point values. 
CGRect(Single, Single, Single, Single) 
Constructs a rectangle with the specified dimensions. 
Fields
Empty 
Represents a CGRect structure with its properties left uninitialized. 
Properties
Bottom 
Gets the ycoordinate that is the sum of the Y and Height property values of this CGRect structure. 
Height 
Gets or sets the height of this CGRect structure. 
Infinite 
Gets an infinitely large rectangle. 
IsEmpty 
Tests whether all numeric properties of this CGRect have values of zero. 
Left 
Gets the xcoordinate of the left edge of this CGRect structure. 
Location 
Gets or sets the coordinates of the upperleft corner of this CGRect structure. 
Null 
Gets an invalid, or null, rectangle. 
Right 
Gets the xcoordinate that is the sum of X and Width property values of this CGRect structure. 
Size 
Gets or sets the size of this CGRect. 
Top 
The Y coordinate of the top of the rectangle. 
Width 
Gets or sets the width of this CGRect structure. 
X 
Gets or sets the xcoordinate of the upperleft corner of this CGRect structure. 
Y 
Gets or sets the ycoordinate of the upperleft corner of this CGRect structure. 
Methods
Contains(CGPoint) 
Determines if the specified point is contained within this CGRect structure. 
Contains(CGRect) 
Determines if the rectangular region represented by 
Contains(Double, Double) 

Contains(nfloat, nfloat) 
Determines if the specified point is contained within this CGRect structure. 
Contains(Single, Single) 
Determines if the specified point is contained within this CGRect structure. 
Equals(CGRect) 
Tests whether 
Equals(Object) 
Tests whether 
FromLTRB(nfloat, nfloat, nfloat, nfloat) 
Creates a CGRect structure with the specified edge locations. 
GetHashCode() 
Returns the hash code for this CGRect structure. For information about the use of hash codes, see M:System.Object.GetHashCode* . 
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. 
Inflate(CGSize) 
Enlarges this CGRect by the specified amount. 
Inflate(Double, Double) 
Increases the size of the rectangle by adding the specified amounts along both directions of each axis. 
Inflate(nfloat, nfloat) 
Enlarges this CGRect by the specified amount. 
Inflate(Single, Single)  
Intersect(CGRect) 
Replaces this CGRect with the intersection of itself and the specified 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) 
Determines if this rectangle intersects with 
Offset(CGPoint) 
Adjusts the location of this rectangle by the specified amount. 
Offset(Double, Double) 
Adjusts the location of this rectangle by the specified amount. 
Offset(nfloat, nfloat) 
Adjusts the location of this rectangle by the specified amount. 
Offset(Single, Single) 
Adjusts the location of this rectangle by the specified amount. 
ToDictionary() 
Serializes the state of the rectangle into an NSDictionary. 
ToString() 
Gets the ycoordinate of the top edge of this CGRect structure. 
TryParse(NSDictionary, CGRect)  
Union(CGRect, CGRect) 
Gets a CGRect structure that contains the union of two CGRect structures. 
Operators
Equality(CGRect, CGRect) 
Tests whether two CGRect structures have equal location and size. 
Explicit(CGRect to Rectangle)  
Explicit(CGRect to RectangleF) 
Converts a CGRect to a RectangleF. 
Implicit(Rectangle to CGRect)  
Implicit(RectangleF to CGRect) 
Implicitly converts a RectangleF to a CGRect. 
Inequality(CGRect, CGRect) 
Peforms a value comparison of two rectangles. 