Table of Contents

Struct XUnitPt

Namespace
PdfSharp.Drawing
Assembly
PdfSharp.dll

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

XUnitPt

Properties

Centimeter

Gets or sets the value in centimeter.

public double Centimeter { get; set; }

Property Value

double

Inch

Gets or sets the value in inch.

public double Inch { get; set; }

Property Value

double

Millimeter

Gets or sets the value in millimeter.

public double Millimeter { get; set; }

Property Value

double

Point

Gets or sets the value in point.

public double Point { get; set; }

Property Value

double

Presentation

Gets or sets the value in presentation units (1/96 inch).

public double Presentation { get; set; }

Property Value

double

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

double

Methods

CompareTo(XUnitPt)

Compares this XUnitPt with another XUnitPt value.

public int CompareTo(XUnitPt other)

Parameters

other XUnitPt

Returns

int

CompareTo(object?)

Compares this XUnitPt with another object.

public int CompareTo(object? obj)

Parameters

obj object

Returns

int

Equals(object?)

Calls base class Equals.

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

FromCentimeter(double)

Returns an XUnitPt object. Converts the value to Point.

public static XUnitPt FromCentimeter(double value)

Parameters

value double

Returns

XUnitPt

FromInch(double)

Returns an XUnitPt object. Converts the value to Point.

public static XUnitPt FromInch(double value)

Parameters

value double

Returns

XUnitPt

FromMillimeter(double)

Returns an XUnitPt object. Converts the value to Point.

public static XUnitPt FromMillimeter(double value)

Parameters

value double

Returns

XUnitPt

FromPoint(double)

Returns an XUnitPt object.

public static XUnitPt FromPoint(double value)

Parameters

value double

Returns

XUnitPt

FromPresentation(double)

Returns an XUnitPt object. Converts the value to Point.

public static XUnitPt FromPresentation(double value)

Parameters

value double

Returns

XUnitPt

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

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

bool

ToString()

Returns the object as string. The unit of measure is appended to the end of the string.

public override string ToString()

Returns

string

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

string

Operators

operator +(XUnitPt, XUnitPt)

Adds an XUnitPt to an XUnitPt.

public static XUnitPt operator +(XUnitPt l, XUnitPt r)

Parameters

l XUnitPt
r XUnitPt

Returns

XUnitPt

operator +(XUnitPt, string)

Adds a string parsed as XUnitPt to an XUnitPt.

public static XUnitPt operator +(XUnitPt l, string r)

Parameters

l XUnitPt
r string

Returns

XUnitPt

operator /(XUnitPt, double)

Divides an XUnitPt by a double.

public static XUnitPt operator /(XUnitPt l, double r)

Parameters

l XUnitPt
r double

Returns

XUnitPt

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

l XUnitPt
r XUnitPt

Returns

bool

operator >(XUnitPt, XUnitPt)

Compares two XUnitPt values.

public static bool operator >(XUnitPt l, XUnitPt r)

Parameters

l XUnitPt
r XUnitPt

Returns

bool

operator >=(XUnitPt, XUnitPt)

Compares two XUnitPt values.

public static bool operator >=(XUnitPt l, XUnitPt r)

Parameters

l XUnitPt
r XUnitPt

Returns

bool

implicit operator XUnitPt(XUnit)

Converts an XUnit to an XUnitPt object.

public static implicit operator XUnitPt(XUnit value)

Parameters

value XUnit

Returns

XUnitPt

implicit operator XUnit(XUnitPt)

Converts an XUnitPt to an XUnit object.

public static implicit operator XUnit(XUnitPt value)

Parameters

value XUnitPt

Returns

XUnit

implicit operator double(XUnitPt)

Converts an XUnitPt to a double value as point.

public static implicit operator double(XUnitPt value)

Parameters

value XUnitPt

Returns

double

implicit operator XUnitPt(double)

Converts a double to an XUnitPt object.

public static implicit operator XUnitPt(double value)

Parameters

value double

Returns

XUnitPt

implicit operator XUnitPt(int)

Converts an int to an XUnitPt object.

public static implicit operator XUnitPt(int value)

Parameters

value int

Returns

XUnitPt

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

XUnitPt

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

l XUnitPt
r XUnitPt

Returns

bool

operator <(XUnitPt, XUnitPt)

Compares two XUnitPt values.

public static bool operator <(XUnitPt l, XUnitPt r)

Parameters

l XUnitPt
r XUnitPt

Returns

bool

operator <=(XUnitPt, XUnitPt)

Compares two XUnitPt values.

public static bool operator <=(XUnitPt l, XUnitPt r)

Parameters

l XUnitPt
r XUnitPt

Returns

bool

operator *(XUnitPt, double)

Multiplies an XUnitPt with a double.

public static XUnitPt operator *(XUnitPt l, double r)

Parameters

l XUnitPt
r double

Returns

XUnitPt

operator -(XUnitPt, XUnitPt)

Subtracts an XUnitPt from an XUnitPt.

public static XUnitPt operator -(XUnitPt l, XUnitPt r)

Parameters

l XUnitPt
r XUnitPt

Returns

XUnitPt

operator -(XUnitPt, string)

Subtracts a string parsed as UnitPt from an XUnitPt.

public static XUnitPt operator -(XUnitPt l, string r)

Parameters

l XUnitPt
r string

Returns

XUnitPt

operator -(XUnitPt)

Returns the negative value of an XUnitPt.

public static XUnitPt operator -(XUnitPt value)

Parameters

value XUnitPt

Returns

XUnitPt