PdfSharp-GDI  1.31.7289
PdfSharp.Drawing.XUnit Struct Reference

Represents a value and its unit of measure. The structure converts implicitly from and to double with a value measured in point. More...

Inheritance diagram for PdfSharp.Drawing.XUnit:

Public Member Functions

 XUnit (double point)
 Initializes a new instance of the XUnit class with type set to point. More...
 
 XUnit (double value, XGraphicsUnit type)
 Initializes a new instance of the XUnit class. More...
 
string ToString (IFormatProvider formatProvider)
 Returns the object as string using the format information. The unit of measure is appended to the end of the string. More...
 
string IFormattable. ToString (string format, IFormatProvider formatProvider)
 Returns the object as string using the specified format and format information. The unit of measure is appended to the end of the string. More...
 
override string ToString ()
 Returns the object as string. The unit of measure is appended to the end of the string. More...
 
string GetSuffix ()
 Returns the unit of measure of the object as a string like 'pt', 'cm', or 'in'. More...
 
override bool Equals (Object obj)
 Calls base class Equals. More...
 
override int GetHashCode ()
 Returns the hash code for this instance. More...
 
void ConvertType (XGraphicsUnit type)
 Converts an existing object from one unit into another unit type. More...
 

Static Public Member Functions

static XUnit FromPoint (double value)
 Returns an XUnit object. Sets type to point. More...
 
static XUnit FromInch (double value)
 Returns an XUnit object. Sets type to inch. More...
 
static XUnit FromMillimeter (double value)
 Returns an XUnit object. Sets type to millimeters. More...
 
static XUnit FromCentimeter (double value)
 Returns an XUnit object. Sets type to centimeters. More...
 
static XUnit FromPresentation (double value)
 Returns an XUnit object. Sets type to Presentation. More...
 
static implicit operator XUnit (string value)
 Converts a string to an XUnit object. If the string contains a suffix like 'cm' or 'in' the object will be converted to the appropriate type, otherwise point is assumed. More...
 
static implicit operator XUnit (int value)
 Converts an int to an XUnit object with type set to point. More...
 
static implicit operator XUnit (double value)
 Converts a double to an XUnit object with type set to point. More...
 
static implicit operator double (XUnit value)
 Returns a double value as point. More...
 
static bool operator== (XUnit value1, XUnit value2)
 Memberwise comparison. To compare by value, use code like Math.Abs(a.Pt - b.Pt) < 1e5. More...
 
static bool operator!= (XUnit value1, XUnit value2)
 Memberwise comparison. To compare by value, use code like Math.Abs(a.Pt - b.Pt) < 1e5. More...
 
static XUnit Parse (string value)
 This member is intended to be used by XmlDomainObjectReader only. More...
 

Public Attributes

double value
 
XGraphicsUnit type
 

Static Public Attributes

static readonly XUnit Zero
 Represents a unit with all values zero. More...
 

Properties

double Value [get]
 Gets the raw value of the object without any conversion. To determine the XGraphicsUnit use property More...
 
XGraphicsUnit Type [get]
 Gets the unit of measure. More...
 
double Point [get, set]
 Gets or sets the value in point. More...
 
double Inch [get, set]
 Gets or sets the value in inch. More...
 
double Millimeter [get, set]
 Gets or sets the value in millimeter. More...
 
double Centimeter [get, set]
 Gets or sets the value in centimeter. More...
 
double Presentation [get, set]
 Gets or sets the value in presentation units (1/96 inch). More...
 

Detailed Description

Represents a value and its unit of measure. The structure converts implicitly from and to double with a value measured in point.

Constructor & Destructor Documentation

◆ XUnit() [1/2]

PdfSharp.Drawing.XUnit.XUnit ( double  point)

Initializes a new instance of the XUnit class with type set to point.

◆ XUnit() [2/2]

PdfSharp.Drawing.XUnit.XUnit ( double  value,
XGraphicsUnit  type 
)

Initializes a new instance of the XUnit class.

Member Function Documentation

◆ ConvertType()

void PdfSharp.Drawing.XUnit.ConvertType ( XGraphicsUnit  type)

Converts an existing object from one unit into another unit type.

◆ Equals()

override bool PdfSharp.Drawing.XUnit.Equals ( Object  obj)

Calls base class Equals.

◆ FromCentimeter()

static XUnit PdfSharp.Drawing.XUnit.FromCentimeter ( double  value)
static

Returns an XUnit object. Sets type to centimeters.

◆ FromInch()

static XUnit PdfSharp.Drawing.XUnit.FromInch ( double  value)
static

Returns an XUnit object. Sets type to inch.

◆ FromMillimeter()

static XUnit PdfSharp.Drawing.XUnit.FromMillimeter ( double  value)
static

Returns an XUnit object. Sets type to millimeters.

◆ FromPoint()

static XUnit PdfSharp.Drawing.XUnit.FromPoint ( double  value)
static

Returns an XUnit object. Sets type to point.

◆ FromPresentation()

static XUnit PdfSharp.Drawing.XUnit.FromPresentation ( double  value)
static

Returns an XUnit object. Sets type to Presentation.

◆ GetHashCode()

override int PdfSharp.Drawing.XUnit.GetHashCode ( )

Returns the hash code for this instance.

◆ GetSuffix()

string PdfSharp.Drawing.XUnit.GetSuffix ( )

Returns the unit of measure of the object as a string like 'pt', 'cm', or 'in'.

◆ operator double()

static implicit PdfSharp.Drawing.XUnit.operator double ( XUnit  value)
static

Returns a double value as point.

◆ operator XUnit() [1/3]

static implicit PdfSharp.Drawing.XUnit.operator XUnit ( double  value)
static

Converts a double to an XUnit object with type set to point.

◆ operator XUnit() [2/3]

static implicit PdfSharp.Drawing.XUnit.operator XUnit ( int  value)
static

Converts an int to an XUnit object with type set to point.

◆ operator XUnit() [3/3]

static implicit PdfSharp.Drawing.XUnit.operator XUnit ( string  value)
static

Converts a string to an XUnit object. If the string contains a suffix like 'cm' or 'in' the object will be converted to the appropriate type, otherwise point is assumed.

◆ operator!=()

static bool PdfSharp.Drawing.XUnit.operator!= ( XUnit  value1,
XUnit  value2 
)
static

Memberwise comparison. To compare by value, use code like Math.Abs(a.Pt - b.Pt) < 1e5.

◆ operator==()

static bool PdfSharp.Drawing.XUnit.operator== ( XUnit  value1,
XUnit  value2 
)
static

Memberwise comparison. To compare by value, use code like Math.Abs(a.Pt - b.Pt) < 1e5.

◆ Parse()

static XUnit PdfSharp.Drawing.XUnit.Parse ( string  value)
static

This member is intended to be used by XmlDomainObjectReader only.

◆ ToString() [1/3]

override string PdfSharp.Drawing.XUnit.ToString ( )

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

◆ ToString() [2/3]

string PdfSharp.Drawing.XUnit.ToString ( IFormatProvider  formatProvider)

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

◆ ToString() [3/3]

string IFormattable. PdfSharp.Drawing.XUnit.ToString ( string  format,
IFormatProvider  formatProvider 
)

Returns the object as string using the specified format and format information. The unit of measure is appended to the end of the string.

Member Data Documentation

◆ type

XGraphicsUnit PdfSharp.Drawing.XUnit.type

◆ value

double PdfSharp.Drawing.XUnit.value

◆ Zero

readonly XUnit PdfSharp.Drawing.XUnit.Zero
static

Represents a unit with all values zero.

Property Documentation

◆ Centimeter

double PdfSharp.Drawing.XUnit.Centimeter
getset

Gets or sets the value in centimeter.

◆ Inch

double PdfSharp.Drawing.XUnit.Inch
getset

Gets or sets the value in inch.

◆ Millimeter

double PdfSharp.Drawing.XUnit.Millimeter
getset

Gets or sets the value in millimeter.

◆ Point

double PdfSharp.Drawing.XUnit.Point
getset

Gets or sets the value in point.

◆ Presentation

double PdfSharp.Drawing.XUnit.Presentation
getset

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

◆ Type

XGraphicsUnit PdfSharp.Drawing.XUnit.Type
get

Gets the unit of measure.

◆ Value

double PdfSharp.Drawing.XUnit.Value
get

Gets the raw value of the object without any conversion. To determine the XGraphicsUnit use property

Type. To get the value in point use the implicit conversion to double.


The documentation for this struct was generated from the following file: