[]
Initializes a new instance of the Unit structure from a string. See remarks for details.
public Unit(string str)
Type | Name | Description |
---|---|---|
string | str | A string representing the value. |
(In the description that follows, "object" means a RenderObject or another document object on which the current Unit represents a dimension or a coordinate, not the Unit structure itself.)
The str
string should contain a valid Unit value
in one of the following forms:
In this case DefaultUnit determines the unit of measurement.
The following unit type qualifiers are supported (for each type, the corresponding element of the UnitTypeEnum enumeration is listed):
(Percentage can only be used to specify width or height, and is not valid for coordinates.)
The referenced object may be identified by any of the following key words:
The referenced dimension or coordinate may be specified using any of the following key words:
Examples of unit expressions are:
Initializes a new instance of the Unit structure with an absolute length value.
public Unit(double value, UnitTypeEnum unitType)
Type | Name | Description |
---|---|---|
double | value | The unit value. |
UnitTypeEnum | unitType | The unit of measurement. |