Struct RelativePoint
- Namespace
- Avalonia
- Assembly
- Avalonia.Base.dll
Defines a point that may be defined relative to a containing element.
public readonly struct RelativePoint : IEquatable<RelativePoint>
- Implements
- Inherited Members
Constructors
RelativePoint(Point, RelativeUnit)
Initializes a new instance of the RelativePoint struct.
public RelativePoint(Point point, RelativeUnit unit)
Parameters
point
PointThe point.
unit
RelativeUnitThe unit.
RelativePoint(double, double, RelativeUnit)
Initializes a new instance of the RelativePoint struct.
public RelativePoint(double x, double y, RelativeUnit unit)
Parameters
x
doubleThe X point.
y
doubleThe Y point
unit
RelativeUnitThe unit.
Fields
BottomRight
A point at the bottom right of the containing element.
public static readonly RelativePoint BottomRight
Field Value
Center
A point at the center of the containing element.
public static readonly RelativePoint Center
Field Value
TopLeft
A point at the top left of the containing element.
public static readonly RelativePoint TopLeft
Field Value
Properties
Point
Gets the point.
public Point Point { get; }
Property Value
Unit
Gets the unit.
public RelativeUnit Unit { get; }
Property Value
Methods
Equals(RelativePoint)
Checks if the RelativePoint equals another point.
public bool Equals(RelativePoint p)
Parameters
p
RelativePointThe other point.
Returns
- bool
True if the objects are equal, otherwise false.
Equals(object?)
Checks if the RelativePoint 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 RelativePoint.
public override int GetHashCode()
Returns
- int
A hash code.
Parse(string)
Parses a RelativePoint string.
public static RelativePoint Parse(string s)
Parameters
s
stringThe string.
Returns
- RelativePoint
The parsed RelativePoint.
ToPixels(Rect)
Converts a RelativePoint into pixels.
public Point ToPixels(Rect rect)
Parameters
rect
RectThe bounding box of the rendering primitive.
Returns
- Point
The origin point in pixels.
ToPixels(Size)
Converts a RelativePoint into pixels.
public Point ToPixels(Size size)
Parameters
size
SizeThe size of the visual.
Returns
- Point
The origin point in pixels.
ToString()
Returns a String representing this RelativePoint instance.
public override string ToString()
Returns
- string
The string representation.
Operators
operator ==(RelativePoint, RelativePoint)
Checks for equality between two RelativePoints.
public static bool operator ==(RelativePoint left, RelativePoint right)
Parameters
left
RelativePointThe first point.
right
RelativePointThe second point.
Returns
- bool
True if the points are equal; otherwise false.
operator !=(RelativePoint, RelativePoint)
Checks for inequality between two RelativePoints.
public static bool operator !=(RelativePoint left, RelativePoint right)
Parameters
left
RelativePointThe first point.
right
RelativePointThe second point.
Returns
- bool
True if the points are unequal; otherwise false.