Table of Contents

Struct XRect

Namespace
PdfSharp.Drawing
Assembly
PdfSharp-gdi.dll

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

point1 XPoint
point2 XPoint

XRect(XPoint, XSize)

Initializes a new instance of the XRect class.

public XRect(XPoint location, XSize size)

Parameters

location XPoint
size XSize

XRect(XPoint, XVector)

Initializes a new instance of the XRect class.

public XRect(XPoint point, XVector vector)

Parameters

point XPoint
vector XVector

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

x double
y double
width double
height double

XRect(PointF, SizeF)

Initializes a new instance of the XRect class.

public XRect(PointF location, SizeF size)

Parameters

location PointF
size SizeF

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

double

BottomLeft

Gets the position of the bottom-left corner of the rectangle.

public XPoint BottomLeft { get; }

Property Value

XPoint

BottomRight

Gets the position of the bottom-right corner of the rectangle.

public XPoint BottomRight { get; }

Property Value

XPoint

Center

Gets the center of the rectangle.

public XPoint Center { get; }

Property Value

XPoint

Empty

Gets the empty rectangle.

public static XRect Empty { get; }

Property Value

XRect

Height

Gets or sets the height of the rectangle.

public double Height { get; set; }

Property Value

double

IsEmpty

Gets a value indicating whether this instance is empty.

public bool IsEmpty { get; }

Property Value

bool

Left

Gets the x-axis value of the left side of the rectangle.

public double Left { get; }

Property Value

double

Location

Gets or sets the location of the rectangle.

public XPoint Location { get; set; }

Property Value

XPoint

Right

Gets the x-axis value of the right side of the rectangle.

public double Right { get; }

Property Value

double

Size

Gets or sets the size of the rectangle.

public XSize Size { get; set; }

Property Value

XSize

Top

Gets the y-axis value of the top side of the rectangle.

public double Top { get; }

Property Value

double

TopLeft

Gets the position of the top-left corner of the rectangle.

public XPoint TopLeft { get; }

Property Value

XPoint

TopRight

Gets the position of the top-right corner of the rectangle.

public XPoint TopRight { get; }

Property Value

XPoint

Width

Gets or sets the width of the rectangle.

public double Width { get; set; }

Property Value

double

X

Gets or sets the X value of the rectangle.

public double X { get; set; }

Property Value

double

Y

Gets or sets the Y value of the rectangle.

public double Y { get; set; }

Property Value

double

Methods

Contains(XPoint)

Indicates whether the rectangle contains the specified point.

public bool Contains(XPoint point)

Parameters

point XPoint

Returns

bool

Contains(XRect)

Indicates whether the rectangle contains the specified rectangle.

public bool Contains(XRect rect)

Parameters

rect XRect

Returns

bool

Contains(double, double)

Indicates whether the rectangle contains the specified point.

public bool Contains(double x, double y)

Parameters

x double
y double

Returns

bool

Equals(XRect)

Determines whether this instance and the specified rect are equal.

public bool Equals(XRect value)

Parameters

value XRect

Returns

bool

Equals(XRect, XRect)

Determines whether the two rectangles are equal.

public static bool Equals(XRect rect1, XRect rect2)

Parameters

rect1 XRect
rect2 XRect

Returns

bool

Equals(object?)

Determines whether this instance and the specified object are equal.

public override bool Equals(object? o)

Parameters

o object

Returns

bool

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

left double
top double
right double
bottom double

Returns

XRect

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

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

rect XRect
size XSize

Returns

XRect

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

rect XRect
width double
height double

Returns

XRect

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

width double
height double

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

rect1 XRect
rect2 XRect

Returns

XRect

IntersectsWith(XRect)

Indicates whether the specified rectangle intersects with the current rectangle.

public bool IntersectsWith(XRect rect)

Parameters

rect XRect

Returns

bool

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

rect XRect
offsetVector XVector

Returns

XRect

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

rect XRect
offsetX double
offsetY double

Returns

XRect

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

offsetX double
offsetY double

Parse(string)

Parses the rectangle from a string.

public static XRect Parse(string source)

Parameters

source string

Returns

XRect

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

scaleX double
scaleY double

ToRectangleF()

Converts this instance to a System.Drawing.RectangleF.

public RectangleF ToRectangleF()

Returns

RectangleF

ToString()

Converts this XRect to a human readable string.

public override string ToString()

Returns

string

ToString(IFormatProvider)

Converts this XRect to a human readable string.

public string ToString(IFormatProvider provider)

Parameters

provider IFormatProvider

Returns

string

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

rect XRect
matrix XMatrix

Returns

XRect

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

rect XRect
point XPoint

Returns

XRect

Union(XRect, XRect)

Returns the union of two rectangles.

public static XRect Union(XRect rect1, XRect rect2)

Parameters

rect1 XRect
rect2 XRect

Returns

XRect

Operators

operator +(XRect, XPoint)

Translates the rectangle by adding the specified point.

public static XRect operator +(XRect rect, XPoint point)

Parameters

rect XRect
point XPoint

Returns

XRect

operator ==(XRect, XRect)

Determines whether the two rectangles are equal.

public static bool operator ==(XRect rect1, XRect rect2)

Parameters

rect1 XRect
rect2 XRect

Returns

bool

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

XRect

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

XRect

operator !=(XRect, XRect)

Determines whether the two rectangles are not equal.

public static bool operator !=(XRect rect1, XRect rect2)

Parameters

rect1 XRect
rect2 XRect

Returns

bool

operator -(XRect, XPoint)

Translates the rectangle by subtracting the specified point.

public static XRect operator -(XRect rect, XPoint point)

Parameters

rect XRect
point XPoint

Returns

XRect