Struct XRect
Stores a set of four floating-point numbers that represent the location and size of a rectangle.
public struct XRect : IFormattable
- Implements
- Inherited Members
Constructors
XRect(XPoint, XPoint)
Initializes a new instance of the XRect class.
public XRect(XPoint point1, XPoint point2)
Parameters
XRect(XPoint, XSize)
Initializes a new instance of the XRect class.
public XRect(XPoint location, XSize size)
Parameters
XRect(XPoint, XVector)
Initializes a new instance of the XRect class.
public XRect(XPoint point, XVector vector)
Parameters
XRect(XSize)
Initializes a new instance of the XRect class.
public XRect(XSize size)
Parameters
size
XSize
XRect(double, double, double, double)
Initializes a new instance of the XRect class.
public XRect(double x, double y, double width, double height)
Parameters
XRect(PointF, SizeF)
Initializes a new instance of the XRect class.
public XRect(PointF location, SizeF size)
Parameters
XRect(RectangleF)
Initializes a new instance of the XRect class.
public XRect(RectangleF rect)
Parameters
rect
RectangleF
Properties
Bottom
Gets the y-axis value of the bottom side of the rectangle.
public double Bottom { get; }
Property Value
BottomLeft
Gets the position of the bottom-left corner of the rectangle.
public XPoint BottomLeft { get; }
Property Value
BottomRight
Gets the position of the bottom-right corner of the rectangle.
public XPoint BottomRight { get; }
Property Value
Center
Gets the center of the rectangle.
public XPoint Center { get; }
Property Value
Empty
Gets the empty rectangle.
public static XRect Empty { get; }
Property Value
Height
Gets or sets the height of the rectangle.
public double Height { get; set; }
Property Value
IsEmpty
Gets a value indicating whether this instance is empty.
public bool IsEmpty { get; }
Property Value
Left
Gets the x-axis value of the left side of the rectangle.
public double Left { get; }
Property Value
Location
Gets or sets the location of the rectangle.
public XPoint Location { get; set; }
Property Value
Right
Gets the x-axis value of the right side of the rectangle.
public double Right { get; }
Property Value
Size
Gets or sets the size of the rectangle.
public XSize Size { get; set; }
Property Value
Top
Gets the y-axis value of the top side of the rectangle.
public double Top { get; }
Property Value
TopLeft
Gets the position of the top-left corner of the rectangle.
public XPoint TopLeft { get; }
Property Value
TopRight
Gets the position of the top-right corner of the rectangle.
public XPoint TopRight { get; }
Property Value
Width
Gets or sets the width of the rectangle.
public double Width { get; set; }
Property Value
X
Gets or sets the X value of the rectangle.
public double X { get; set; }
Property Value
Y
Gets or sets the Y value of the rectangle.
public double Y { get; set; }
Property Value
Methods
Contains(XPoint)
Indicates whether the rectangle contains the specified point.
public bool Contains(XPoint point)
Parameters
point
XPoint
Returns
Contains(XRect)
Indicates whether the rectangle contains the specified rectangle.
public bool Contains(XRect rect)
Parameters
rect
XRect
Returns
Contains(double, double)
Indicates whether the rectangle contains the specified point.
public bool Contains(double x, double y)
Parameters
Returns
Equals(XRect)
Determines whether this instance and the specified rect are equal.
public bool Equals(XRect value)
Parameters
value
XRect
Returns
Equals(XRect, XRect)
Determines whether the two rectangles are equal.
public static bool Equals(XRect rect1, XRect rect2)
Parameters
Returns
Equals(object?)
Determines whether this instance and the specified object are equal.
public override bool Equals(object? o)
Parameters
o
object
Returns
FromLTRB(double, double, double, double)
Creates a rectangle from four straight lines.
public static XRect FromLTRB(double left, double top, double right, double bottom)
Parameters
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
Inflate(XRect, XSize)
Returns the rectangle that results from expanding the specified rectangle by the specified Size, in all directions.
public static XRect Inflate(XRect rect, XSize size)
Parameters
Returns
Inflate(XRect, double, double)
Creates a rectangle that results from expanding or shrinking the specified rectangle by the specified width and height amounts, in all directions.
public static XRect Inflate(XRect rect, double width, double height)
Parameters
Returns
Inflate(XSize)
Expands the rectangle by using the specified Size, in all directions.
public void Inflate(XSize size)
Parameters
size
XSize
Inflate(double, double)
Expands or shrinks the rectangle by using the specified width and height amounts, in all directions.
public void Inflate(double width, double height)
Parameters
Intersect(XRect)
Sets current rectangle to the intersection of the current rectangle and the specified rectangle.
public void Intersect(XRect rect)
Parameters
rect
XRect
Intersect(XRect, XRect)
Returns the intersection of two rectangles.
public static XRect Intersect(XRect rect1, XRect rect2)
Parameters
Returns
IntersectsWith(XRect)
Indicates whether the specified rectangle intersects with the current rectangle.
public bool IntersectsWith(XRect rect)
Parameters
rect
XRect
Returns
Offset(XRect, XVector)
Returns a rectangle that is offset from the specified rectangle by using the specified vector.
public static XRect Offset(XRect rect, XVector offsetVector)
Parameters
Returns
Offset(XRect, double, double)
Returns a rectangle that is offset from the specified rectangle by using specified horizontal and vertical amounts.
public static XRect Offset(XRect rect, double offsetX, double offsetY)
Parameters
Returns
Offset(XVector)
Moves a rectangle by the specified amount.
public void Offset(XVector offsetVector)
Parameters
offsetVector
XVector
Offset(double, double)
Moves a rectangle by the specified amount.
public void Offset(double offsetX, double offsetY)
Parameters
Parse(string)
Parses the rectangle from a string.
public static XRect Parse(string source)
Parameters
source
string
Returns
Scale(double, double)
Multiplies the size of the current rectangle by the specified x and y values.
public void Scale(double scaleX, double scaleY)
Parameters
ToRectangleF()
Converts this instance to a System.Drawing.RectangleF.
public RectangleF ToRectangleF()
Returns
ToString()
Converts this XRect to a human readable string.
public override string ToString()
Returns
ToString(IFormatProvider)
Converts this XRect to a human readable string.
public string ToString(IFormatProvider provider)
Parameters
provider
IFormatProvider
Returns
Transform(XMatrix)
Transforms the rectangle by applying the specified matrix.
public void Transform(XMatrix matrix)
Parameters
matrix
XMatrix
Transform(XRect, XMatrix)
Returns the rectangle that results from applying the specified matrix to the specified rectangle.
public static XRect Transform(XRect rect, XMatrix matrix)
Parameters
Returns
Union(XPoint)
Sets current rectangle to the union of the current rectangle and the specified point.
public void Union(XPoint point)
Parameters
point
XPoint
Union(XRect)
Sets current rectangle to the union of the current rectangle and the specified rectangle.
public void Union(XRect rect)
Parameters
rect
XRect
Union(XRect, XPoint)
Returns the union of a rectangle and a point.
public static XRect Union(XRect rect, XPoint point)
Parameters
Returns
Union(XRect, XRect)
Returns the union of two rectangles.
public static XRect Union(XRect rect1, XRect rect2)
Parameters
Returns
Operators
operator +(XRect, XPoint)
Translates the rectangle by adding the specified point.
public static XRect operator +(XRect rect, XPoint point)
Parameters
Returns
operator ==(XRect, XRect)
Determines whether the two rectangles are equal.
public static bool operator ==(XRect rect1, XRect rect2)
Parameters
Returns
implicit operator XRect(Rectangle)
Performs an implicit conversion from a System.Drawing.Rectangle to an XRect.
public static implicit operator XRect(Rectangle rect)
Parameters
rect
Rectangle
Returns
implicit operator XRect(RectangleF)
Performs an implicit conversion from a System.Drawing.RectangleF to an XRect.
public static implicit operator XRect(RectangleF rect)
Parameters
rect
RectangleF
Returns
operator !=(XRect, XRect)
Determines whether the two rectangles are not equal.
public static bool operator !=(XRect rect1, XRect rect2)
Parameters
Returns
operator -(XRect, XPoint)
Translates the rectangle by subtracting the specified point.
public static XRect operator -(XRect rect, XPoint point)