Struct Rect
Rect structure representing a rectangle, defined by two double coordinates and a double width and double height.
Inherited Members
Namespace: Telerik.Documents.Primitives
Assembly: Telerik.Windows.Documents.Core.dll
Syntax
public struct Rect
Constructors
Rect(Double, Double, Double, Double)
Initializes a new instance of the Rect structure.
Declaration
public Rect(double x, double y, double width, double height)
Parameters
System.Double
x
The X coordinate. |
System.Double
y
The Y coordinate. |
System.Double
width
The width. Should be non-negative. |
System.Double
height
The height. Should be non-negative. |
Properties
Bottom
Gets the Y + Height value. If this is an Empty Rect gets negative-infinity.
Declaration
public double Bottom { get; }
Property Value
System.Double
|
BottomLeft
BottomLeft Property - This is a read-only alias for the Point which is at X, Y + Height If this is the empty rectangle, the value will be positive infinity, negative infinity.
Declaration
public Point BottomLeft { get; }
Property Value
Point
|
BottomRight
BottomRight Property - This is a read-only alias for the Point which is at X + Width, Y + Height If this is the empty rectangle, the value will be negative infinity, negative infinity.
Declaration
public Point BottomRight { get; }
Property Value
Point
|
Empty
Gets an empty Rect. It has negative-infinity Width and Height and positive-infinity X and Y.
Declaration
public static Rect Empty { get; }
Property Value
Rect
|
Height
Gets or sets the Height. Cannot set Height if this is an Empty Rect. Should be non-negative.
Declaration
public double Height { get; set; }
Property Value
System.Double
|
IsEmpty
Returns true if this is the Empty Rect.
Declaration
public bool IsEmpty { get; }
Property Value
System.Boolean
|
Left
Gets the value of the X coordinate.
Declaration
public double Left { get; }
Property Value
System.Double
|
Location
Gets or sets the coordinates of the upper-left corner of this Rect structure.
Declaration
public Point Location { get; set; }
Property Value
Point
|
Right
Gets the X + Width value. If this is an Empty Rect returns negative-infinity.
Declaration
public double Right { get; }
Property Value
System.Double
|
Size
Size - The Size representing the area of the Rectangle
Declaration
public Size Size { get; set; }
Property Value
Size
|
Top
Gets the value of the Y coordinate.
Declaration
public double Top { get; }
Property Value
System.Double
|
TopLeft
TopLeft Property - This is a read-only alias for the Point which is at X, Y If this is the empty rectangle, the value will be positive infinity, positive infinity.
Declaration
public Point TopLeft { get; }
Property Value
Point
|
TopRight
TopRight Property - This is a read-only alias for the Point which is at X + Width, Y If this is the empty rectangle, the value will be negative infinity, positive infinity.
Declaration
public Point TopRight { get; }
Property Value
Point
|
Width
Gets or sets the Width. Cannot set Width if this is an Empty Rect. Should be non-negative.
Declaration
public double Width { get; set; }
Property Value
System.Double
|
X
Gets or sets the X coordinate. Cannot set X if this is an Empty Rect.
Declaration
public double X { get; set; }
Property Value
System.Double
|
Y
Gets or sets the Y coordinate. Cannot set Y if this is an Empty Rect.
Declaration
public double Y { get; set; }
Property Value
System.Double
|
Methods
Contains(Double, Double)
Returns a value indicating whether the x, y coordinates are inside the rectangle, including the edges.
Declaration
public bool Contains(double x, double y)
Parameters
System.Double
x
|
System.Double
y
|
Returns
System.Boolean
|
Contains(Rect)
Contains - Returns true if the Rect non-Empty and is entirely contained within the rectangle, inclusive of the edges. Returns false otherwise
Declaration
public bool Contains(Rect rect)
Parameters
Rect
rect
|
Returns
System.Boolean
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
System.Object
obj
|
Returns
System.Boolean
|
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
System.Int32
|
Overrides
Intersect(Rect)
Intersect - Update this rectangle to be the intersection of this and rect If either this or rect are Empty, the result is Empty as well.
Declaration
public void Intersect(Rect rect)
Parameters
Rect
rect
The rect to intersect with this |
IntersectsWith(Rect)
IntersectsWith - Returns true if the Rect intersects with this rectangle Returns false otherwise. Note that if one edge is coincident, this is considered an intersection.
Declaration
public bool IntersectsWith(Rect rect)
Parameters
Rect
rect
Rect |
Returns
System.Boolean
Returns true if the Rect intersects with this rectangle Returns false otherwise. or Height |
Union(Rect)
This Rect becomes a the result of union of this and otherRect.
Declaration
public void Union(Rect otherRect)
Parameters
Rect
otherRect
|
Operators
Equality(Rect, Rect)
Compares two Rect instances for exact equality.
Declaration
public static bool operator ==(Rect firstRect, Rect secondRect)
Parameters
Rect
firstRect
The first Rect to compare. |
Rect
secondRect
The second Rect to compare. |
Returns
System.Boolean
True if the two Rects are exactly equal; otherwise false. |
Inequality(Rect, Rect)
Compares two Rect instances for exact inequality.
Declaration
public static bool operator !=(Rect firstRect, Rect secondRect)
Parameters
Rect
firstRect
The first Rect to compare. |
Rect
secondRect
The second Rect to compare. |
Returns
System.Boolean
True if the two Rects are exactly unequal; otherwise false. |