[]
        
(Showing Draft Content)

C1.WPF.Document.Unit

Unit Struct

A utility structure specifying some values related to units of measurement.

Namespace: C1.WPF.Document
Assembly: C1.WPF.Document.4.6.2.dll
Syntax
public struct Unit

Constructors

Name Description
Unit(double, UnitTypeEnum)

Initializes a new instance of the Unit structure.

Unit(string)

Initializes a new instance of the Unit structure from a string. String should contain A numeric value qualified with unit of measurement, e.g. "28mm" or "7in".

Fields

Name Description
BoldLineWidth
CmPerInch

Centimeters per inch as double.

CmPerInchF

Centimeters per inch as float.

DipPerInch

DIP units per inch as double.

DisplayPerInch

Display units per inch as double.

DisplayPerInchF

Display units per inch as float.

DocumentUnitsPerInch

Document units per inch as double.

DocumentUnitsPerInchF

Document units per inch as float.

LineWidth
MmPerInch

Millimeters per inch as double.

MmPerInchF

Millimeters per inch as float.

PicaPerInch

Picas per inch as double.

PicaPerInchF

Picas per inch as float.

PointsPerInch

Points per inch as double.

PointsPerInchF

Points per inch as float.

PositiveInfinity
TwipsPerInch

Twips per inch as double.

TwipsPerInchF

Twips per inch as float.

Zero

Properties

Name Description
Units

Gets the unit of measurement of the current unit.

Value

Gets the value of the current unit (in Units).

Methods

Name Description
Convert(UnitTypeEnum)

Converts value of this Unit structure to value in specified units of measurement.

Convert(double, UnitTypeEnum, UnitTypeEnum)

Converts a value from one unit of measurement to another.

Convert(double, UnitTypeEnum, double)

Converts a value from one unit of measurement to pixel.

Convert(double, double, UnitTypeEnum)

Converts a value from pixel unit of measurement to another.

Parse(string)

Parses a string and creates a Unit instance from that string, throws an exception if string is invalid.

StringToUnitType(string, ref UnitTypeEnum)

Converts a string to a UnitTypeEnum value. The string can be one of the following: "doc", "in", "mm", "pc", "dsp", "pt", "tw", "inhs", "cm", "dip". This method is case-insensitive.

ToString()

Converts the current object to a string.

TryParse(string, out Unit)

Parses a string and creates Unit structure.

TryParse(string, out double, out UnitTypeEnum)

Parses a string and gets Value and Units from that string.

UnitTypeToString(UnitTypeEnum)

Converts a UnitTypeEnum value to a string representation as in the following table:

  • Document"doc"
  • Inch"in"
  • Millimeter"mm"
  • Pica"pc"
  • Point"pt"
  • Twip"tw"
  • InHs"inhs"
  • Centimeters"cm"
  • Dip"dip"

Operators

Name Description
implicit operator string(Unit)

Converts a unit value to a string.

implicit operator Unit(string)

Converts a string to a Unit value (see Unit(string).