Upravit

Sdílet prostřednictvím


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
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 y-coordinate 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 x-coordinate of the left edge of this CGRect structure.

Location

Gets or sets the coordinates of the upper-left corner of this CGRect structure.

Null

Gets an invalid, or null, rectangle.

Right

Gets the x-coordinate 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 x-coordinate of the upper-left corner of this CGRect structure.

Y

Gets or sets the y-coordinate of the upper-left 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 rect is entirely contained within this CGRect structure.

Contains(Double, Double)

true if the point [x, y] is within the rectangle.

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 rect is a CGRect structure with the same location and size of this CGRect structure.

Equals(Object)

Tests whether obj is a CGRect structure with the same location and size of this CGRect structure.

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, 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.

Intersect(CGRect)

Replaces this CGRect with the intersection of itself and the specified CGRect.

IntersectsWith(CGRect)

Determines if this rectangle intersects with rect.

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 y-coordinate 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)

Converts a CGRect to a Rectangle.

Explicit(CGRect to RectangleF)

Converts a CGRect to a RectangleF.

Implicit(Rectangle to CGRect)

Implicitly converts a Rectangle to a CGRect.

Implicit(RectangleF to CGRect)

Implicitly converts a RectangleF to a CGRect.

Inequality(CGRect, CGRect)

Peforms a value comparison of two rectangles.

Extension Methods

WithAspectRatio(CGRect, CGSize)
Divide(CGRect, nfloat, CGRectEdge, CGRect, CGRect)
GetMaxX(CGRect)
GetMaxY(CGRect)
GetMidX(CGRect)
GetMidY(CGRect)
GetMinX(CGRect)
GetMinY(CGRect)
Inset(CGRect, nfloat, nfloat)
Integral(CGRect)
IsInfinite(CGRect)
IsNull(CGRect)
Standardize(CGRect)
UnionWith(CGRect, CGRect)

Applies to