[]
A utility structure specifying some values related to units of measurement.
public struct Unit
Public Structure Unit
Name | Description |
---|---|
Unit(float, 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". |
Name | Description |
---|---|
CmPerInch | Centimeters per inch as double. |
DipPerInch | DIP units per inch as double. |
DisplayPerInch | Display units per inch as double. |
DocumentUnitsPerInch | Document units per inch as double. |
MmPerInch | Millimeters per inch as double. |
PicaPerInch | Picas per inch as double. |
PointsPerInch | Points per inch as double. |
TwipsPerInch | Twips per inch as double. |
Zero | Represents "0mm" value. |
Name | Description |
---|---|
Units | Gets the unit of measurement of the current unit. |
Value | Gets the value of the current unit (in Units). |
Name | Description |
---|---|
Convert(UnitTypeEnum) | Converts value of this Unit structure to value in specified units of measurement. |
Convert(float, UnitTypeEnum, UnitTypeEnum) | Converts a value from one unit of measurement to another. |
Convert(float, UnitTypeEnum, float) | Converts a value from one unit of measurement to pixel. |
Convert(float, float, 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 float, out UnitTypeEnum) | |
UnitTypeToString(UnitTypeEnum) | Converts a UnitTypeEnum value to a string representation as in the following table:
|
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). |