[]
Structure specifing a rectangle with double Left, Top, Right, Bottom coordinates.
public struct RectD : IEquatable<RectD>
Initializes a new instance of the RectD struct.
public RectD(RectF rc)
rc
RectFInitializes a new instance of the RectD struct.
public RectD(double x, double y, double width, double height)
x
doubley
doublewidth
doubleheight
doubleInitializes a new instance of the RectD struct.
public RectD(double width, double height)
width
doubleheight
doubleInitializes a new instance of the RectD struct.
public RectD(RectangleF rc)
rc
System.Drawing.RectangleFThe y-coordinate of the bottom edge.
public double Bottom
An empty rectangle.
public static readonly RectD Empty
A rectangle that has its upper-left corner set to (negative infinity, negative infinity) and its lower-right corner set to (infinity, infinity).
public static readonly RectD Infinite
The x-coordinate of the left edge.
public double Left
The x-coordinate of the right edge.
public double Right
The size of the RectD type, in bytes.
public const int SizeInBytes = 32
The y-coordinate of the top edge.
public double Top
Gets the point with coordinates of the rectangle center.
public Point2D Center { get; }
Determines if there is some space within the rectangle.
public bool HasSpace { get; }
Gets or sets the height of the rectangle.
public double Height { get; set; }
Determines if all components of RectD are equal to zero.
public bool IsEmpty { get; }
Gets the point with coordinates of the left top corner of the rectangle.
public Point2D Location { get; }
Gets the size of the rectangle.
public Size2D Size { get; }
Gets or sets the width of the rectangle.
public double Width { get; set; }
Gets or sets the X coordinate of the rectangle.
public double X { get; set; }
Gets or sets the Y coordinate of the rectangle.
public double Y { get; set; }
Returns a RectL with circumscribed coordinates.
public RectL Circumscribe()
Determines if the specified rectangle is fully contained within this rectangle.
public bool Contains(RectD rect)
rect
RectDDetermines if the specified point is contained within this rectangle.
public bool Contains(double x, double y)
x
doubley
doubleIndicates whether this instance and a specified object are equal.
public bool Equals(RectD other)
other
RectDIndicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
obj
objectConverts a rectangle from DIPs to pixels.
public static RectD FromDips(RectD rc, float dpiX, float dpiY)
rc
RectDdpiX
floatdpiY
floatConverts a rectangle from DIPs to pixels.
public void FromDips(float dpiX, float dpiY)
dpiX
floatdpiY
floatCreates a RectD struct from (left, top, right, bottom) coordinates.
public static RectD FromLTRB(double left, double top, double right, double bottom)
left
doubletop
doubleright
doublebottom
doubleReturns a hash code for this instance.
public override int GetHashCode()
Inflates the rectangle by the specified amount.
public static RectD Inflate(RectD rc, double dx, double dy)
rc
RectDdx
doubledy
doubleInflates the rectangle by the specified amount.
public void Inflate(double dx, double dy)
dx
doubledy
doubleReturns a rectangle that represents the intersection of two rectangles.
public static RectD Intersect(RectD a, RectD b)
Quickly updates a rectangle to represent the intersection with another rectangle.
public void IntersectFast(RectD rect)
rect
RectDThe resulting rectangle may be invalid. Use the HasSpace property to check.
Determines if this rectangle intersects with rect.
public bool IntersectsWith(RectD rect)
rect
RectDConverts the rectangle from (X, Y, Width, Height) to (Left, Top, Right, Bottom) coordinates.
public void MakeLTRB()
Converts the rectangle from (Left, Top, Right, Bottom) to (X, Y, Width, Height) coordinates.
public void MakeXYWH()
Offsets the rectangle by the specified amount.
public static RectD Offset(RectD rc, Size2D sz)
Offsets the rectangle by the specified amount.
public static RectD Offset(RectD rc, double dx, double dy)
rc
RectDdx
doubledy
doubleOffsets the rectangle by the specified amount.
public void Offset(double dx, double dy)
dx
doubledy
doubleRecalculates the point coordinates from relative units (0..1, 0..1) to absolute (Left..Right, Top..Bottom).
public Point2D PointFromRect(Point2D pt)
pt
Point2DThe source point in relative coordinates (0..1, 0..1).
The resulting point in absolute coordinates (Left..Right, Top..Bottom).
Returns a RectL with rounded coordinates.
public RectL Round()
Scales all coordinates of a rectangle by the specified scaleX and scaleY.
public static RectD Scale(RectD rc, double scaleX, double scaleY)
rc
RectDscaleX
doublescaleY
doubleScales all coordinates of a rectangle by the specified scaleFactor.
public static RectD Scale(RectD rc, double scaleFactor)
rc
RectDscaleFactor
doubleScales all coordinates of a rectangle by the specified scaleX and scaleY.
public void Scale(double scaleX, double scaleY)
scaleX
doublescaleY
doubleScales all coordinates of a rectangle by the specified scaleFactor.
public void Scale(double scaleFactor)
scaleFactor
doubleConverts a rectangle from pixels to DIPs.
public static RectD ToDips(RectD rc, float dpiX, float dpiY)
rc
RectDdpiX
floatdpiY
floatConverts a rectangle from pixels to DIPs.
public void ToDips(float dpiX, float dpiY)
dpiX
floatdpiY
floatConverts RectD to System.Drawing.RectangleF.
public RectangleF ToRectangleF()
public RectF ToRectF()
Returns a string that represents the current object.
public override string ToString()
Returns a RectL with truncated coordinates.
public RectL Truncate()
Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.
public static RectD Union(RectD a, RectD b)
Determines if the specified values are equal.
public static bool operator ==(RectD left, RectD right)
Determines if the specified values are not equal.
public static bool operator !=(RectD left, RectD right)