Struct RelativeRect
- Namespace
- Avalonia
- Assembly
- Avalonia.Base.dll
Defines a rectangle that may be defined relative to a containing element.
public readonly struct RelativeRect : IEquatable<RelativeRect>
- Implements
- Inherited Members
Constructors
RelativeRect(Point, Point, RelativeUnit)
Initializes a new instance of the RelativeRect structure.
public RelativeRect(Point topLeft, Point bottomRight, RelativeUnit unit)
Parameters
topLeft
PointThe top left position of the rectangle.
bottomRight
PointThe bottom right position of the rectangle.
unit
RelativeUnitThe unit of the rect.
RelativeRect(Point, Size, RelativeUnit)
Initializes a new instance of the RelativeRect structure.
public RelativeRect(Point position, Size size, RelativeUnit unit)
Parameters
position
PointThe position of the rectangle.
size
SizeThe size of the rectangle.
unit
RelativeUnitThe unit of the rect.
RelativeRect(Rect, RelativeUnit)
Initializes a new instance of the RelativeRect structure.
public RelativeRect(Rect rect, RelativeUnit unit)
Parameters
rect
RectThe rectangle.
unit
RelativeUnitThe unit of the rect.
RelativeRect(Size, RelativeUnit)
Initializes a new instance of the RelativeRect structure.
public RelativeRect(Size size, RelativeUnit unit)
Parameters
size
SizeThe size of the rectangle.
unit
RelativeUnitThe unit of the rect.
RelativeRect(double, double, double, double, RelativeUnit)
Initializes a new instance of the RelativeRect structure.
public RelativeRect(double x, double y, double width, double height, RelativeUnit unit)
Parameters
x
doubleThe X position.
y
doubleThe Y position.
width
doubleThe width.
height
doubleThe height.
unit
RelativeUnitThe unit of the rect.
Fields
Fill
A rectangle that represents 100% of an area.
public static readonly RelativeRect Fill
Field Value
Properties
Rect
Gets the rectangle.
public Rect Rect { get; }
Property Value
Unit
Gets the unit of the rectangle.
public RelativeUnit Unit { get; }
Property Value
Methods
Equals(RelativeRect)
Checks if the RelativeRect equals another rectangle.
public bool Equals(RelativeRect p)
Parameters
p
RelativeRectThe other rectangle.
Returns
- bool
True if the objects are equal, otherwise false.
Equals(object?)
Checks if the RelativeRect equals another object.
public override bool Equals(object? obj)
Parameters
obj
objectThe other object.
Returns
- bool
True if the objects are equal, otherwise false.
GetHashCode()
Gets a hashcode for a RelativeRect.
public override int GetHashCode()
Returns
- int
A hash code.
Parse(string)
Parses a RelativeRect string.
public static RelativeRect Parse(string s)
Parameters
s
stringThe string.
Returns
- RelativeRect
The parsed RelativeRect.
ToPixels(Rect)
Converts a RelativeRect into pixels.
public Rect ToPixels(Rect boundingBox)
Parameters
boundingBox
RectThe bounding box of the visual.
Returns
- Rect
The origin point in pixels.
ToPixels(Size)
Converts a RelativeRect into pixels.
public Rect ToPixels(Size size)
Parameters
size
SizeThe size of the visual.
Returns
- Rect
The origin point in pixels.
Operators
operator ==(RelativeRect, RelativeRect)
Checks for equality between two RelativeRects.
public static bool operator ==(RelativeRect left, RelativeRect right)
Parameters
left
RelativeRectThe first rectangle.
right
RelativeRectThe second rectangle.
Returns
- bool
True if the rectangles are equal; otherwise false.
operator !=(RelativeRect, RelativeRect)
Checks for inequality between two RelativeRects.
public static bool operator !=(RelativeRect left, RelativeRect right)
Parameters
left
RelativeRectThe first rectangle.
right
RelativeRectThe second rectangle.
Returns
- bool
True if the rectangles are unequal; otherwise false.