Struct XUnitPt
Represents a value with a unit of measure in point (1/72 inch). The structure converts implicitly from and to double.
public struct XUnitPt : IFormattable, IComparable<XUnitPt>, IComparable
- Implements
- Inherited Members
Constructors
XUnitPt(double)
Initializes a new instance of the XUnitPt class.
public XUnitPt(double value)
Parameters
value
double
Fields
Zero
Represents a unit with all values zero.
public static readonly XUnitPt Zero
Field Value
Properties
Centimeter
Gets or sets the value in centimeter.
public double Centimeter { get; set; }
Property Value
Inch
Gets or sets the value in inch.
public double Inch { get; set; }
Property Value
Millimeter
Gets or sets the value in millimeter.
public double Millimeter { get; set; }
Property Value
Point
Gets or sets the value in point.
public double Point { get; set; }
Property Value
Presentation
Gets or sets the value in presentation units (1/96 inch).
public double Presentation { get; set; }
Property Value
Value
Gets or sets the raw value of the object, which is always measured in point for XUnitPt.
public double Value { readonly get; set; }
Property Value
Methods
CompareTo(XUnitPt)
Compares this XUnitPt with another XUnitPt value.
public int CompareTo(XUnitPt other)
Parameters
other
XUnitPt
Returns
CompareTo(object?)
Compares this XUnitPt with another object.
public int CompareTo(object? obj)
Parameters
obj
object
Returns
Equals(object?)
Calls base class Equals.
public override bool Equals(object? obj)
Parameters
obj
object
Returns
FromCentimeter(double)
Returns an XUnitPt object. Converts the value to Point.
public static XUnitPt FromCentimeter(double value)
Parameters
value
double
Returns
FromInch(double)
Returns an XUnitPt object. Converts the value to Point.
public static XUnitPt FromInch(double value)
Parameters
value
double
Returns
FromMillimeter(double)
Returns an XUnitPt object. Converts the value to Point.
public static XUnitPt FromMillimeter(double value)
Parameters
value
double
Returns
FromPoint(double)
Returns an XUnitPt object.
public static XUnitPt FromPoint(double value)
Parameters
value
double
Returns
FromPresentation(double)
Returns an XUnitPt object. Converts the value to Point.
public static XUnitPt FromPresentation(double value)
Parameters
value
double
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
IsSameValue(XUnitPt)
Compares the actual values of this XUnitPt and another XUnitPt value tolerating rounding errors.
public bool IsSameValue(XUnitPt other)
Parameters
other
XUnitPt
Returns
ToString()
Returns the object as string. The unit of measure is appended to the end of the string.
public override string ToString()
Returns
ToString(IFormatProvider?)
Returns the object as string using the format information. The unit of measure is appended to the end of the string.
public string ToString(IFormatProvider? formatProvider)
Parameters
formatProvider
IFormatProvider
Returns
Operators
operator +(XUnitPt, XUnitPt)
Adds an XUnitPt to an XUnitPt.
public static XUnitPt operator +(XUnitPt l, XUnitPt r)
Parameters
Returns
operator +(XUnitPt, string)
Adds a string parsed as XUnitPt to an XUnitPt.
public static XUnitPt operator +(XUnitPt l, string r)
Parameters
Returns
operator /(XUnitPt, double)
Divides an XUnitPt by a double.
public static XUnitPt operator /(XUnitPt l, double r)
Parameters
Returns
operator ==(XUnitPt, XUnitPt)
Memberwise comparison checking exact value. To compare by value tolerating rounding errors, use IsSameValue() or code like Math.Abs(a.Pt - b.Pt) < 1e-5.
public static bool operator ==(XUnitPt l, XUnitPt r)
Parameters
Returns
operator >(XUnitPt, XUnitPt)
Compares two XUnitPt values.
public static bool operator >(XUnitPt l, XUnitPt r)
Parameters
Returns
operator >=(XUnitPt, XUnitPt)
Compares two XUnitPt values.
public static bool operator >=(XUnitPt l, XUnitPt r)
Parameters
Returns
implicit operator XUnitPt(XUnit)
Converts an XUnit to an XUnitPt object.
public static implicit operator XUnitPt(XUnit value)
Parameters
value
XUnit
Returns
implicit operator XUnit(XUnitPt)
Converts an XUnitPt to an XUnit object.
public static implicit operator XUnit(XUnitPt value)
Parameters
value
XUnitPt
Returns
implicit operator double(XUnitPt)
Converts an XUnitPt to a double value as point.
public static implicit operator double(XUnitPt value)
Parameters
value
XUnitPt
Returns
implicit operator XUnitPt(double)
Converts a double to an XUnitPt object.
public static implicit operator XUnitPt(double value)
Parameters
value
double
Returns
implicit operator XUnitPt(int)
Converts an int to an XUnitPt object.
public static implicit operator XUnitPt(int value)
Parameters
value
int
Returns
implicit operator XUnitPt(string)
Converts a string to an XUnitPt object. If the string contains a suffix like 'cm' or 'in' the value will be converted to point.
public static implicit operator XUnitPt(string value)
Parameters
value
string
Returns
operator !=(XUnitPt, XUnitPt)
Memberwise comparison checking exact value. To compare by value tolerating rounding errors, use IsSameValue() or code like Math.Abs(a.Pt - b.Pt) < 1e-5.
public static bool operator !=(XUnitPt l, XUnitPt r)
Parameters
Returns
operator <(XUnitPt, XUnitPt)
Compares two XUnitPt values.
public static bool operator <(XUnitPt l, XUnitPt r)
Parameters
Returns
operator <=(XUnitPt, XUnitPt)
Compares two XUnitPt values.
public static bool operator <=(XUnitPt l, XUnitPt r)
Parameters
Returns
operator *(XUnitPt, double)
Multiplies an XUnitPt with a double.
public static XUnitPt operator *(XUnitPt l, double r)
Parameters
Returns
operator -(XUnitPt, XUnitPt)
Subtracts an XUnitPt from an XUnitPt.
public static XUnitPt operator -(XUnitPt l, XUnitPt r)
Parameters
Returns
operator -(XUnitPt, string)
Subtracts a string parsed as UnitPt from an XUnitPt.
public static XUnitPt operator -(XUnitPt l, string r)
Parameters
Returns
operator -(XUnitPt)
Returns the negative value of an XUnitPt.
public static XUnitPt operator -(XUnitPt value)
Parameters
value
XUnitPt