[]
        
(Showing Draft Content)

C1.C1Preview.Unit

Unit Struct

A structure representing a single coordinate or dimension of an object (e.g. X or Height of a RenderObject) in a C1PrintDocument.

Namespace: C1.C1Preview
Assembly: C1.PrintDocument.4.8.dll
Syntax
[TypeConverter(typeof(Unit.TypeConverter))]
public struct Unit
Remarks

The value may be "auto", absolute (e.g. "5mm"), or an expression (e.g. "prev.width + 12mm"). See Unit(string) for more details.

Constructors

Name Description
Unit(double, UnitTypeEnum)

Initializes a new instance of the Unit structure with an absolute length value.

Unit(string)

Initializes a new instance of the Unit structure from a string. See remarks for details.

Properties

Name Description
Auto

Gets a Unit representing an "auto" value.

BoldLineWidth

Gets a Unit value representing the default "bold" line thickness (2 points wide).

Empty

Gets a Unit representing an emtpy (zero) value.

IsAbs

Gets a value indicating whether the current unit represents an absolute value (such as "1mm", "2in", "3em" and so on).

IsAuto

Gets a value indicating whether the current unit represents an "auto" value.

IsEmpty

Gets a value indicating whether the current unit represents an empty value.

IsParent

Gets a value indicating whether the current unit is specified as "parent".

IsParentHeight

Gets a value indicating whether the current unit is specified as "parent.height".

IsParentWidth

Gets a value indicating whether the current unit is specified as "parent.width".

LineWidth

Gets a Unit value representing the default line thickness (1 point wide).

Units

Gets the unit of measurement of the current unit.

Value

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

Methods

Name Description
ConvertUnit(UnitTypeEnum)

Attempts to convert the current unit value to other unit of measurement.

Only absolute units can be converted. This method throws an exception if the conversion cannot be performed.

ConvertUnit(UnitTypeEnum, float)

Attempts to convert the current unit value to other unit of measurement.

Only absolute units can be converted. This method throws an exception if the conversion cannot be performed.

ConvertUnit(float, UnitTypeEnum, float)

Attempts to convert the current unit value to other unit of measurement.

Only absolute units can be converted. This method throws an exception if the conversion cannot be performed.

Equals(object)

Compares the current unit value with another object.

FromObject(object)

Attempts to convert an object to a unit value. This method throws an exception if the conversion cannot be performed.

GetHashCode()

Gets the hash code for the current unit value.

ToString()

Returns a string that represents the current object.

Operators

Name Description
operator +(Unit, Unit)

Addition of two unit values.

operator ==(Unit, Unit)

Tests whether the two unit values are equal.

implicit operator double(Unit)

Returns the absolute value of a Unit expressed in Default units.

Throws exception if the operation cannot be performed.

implicit operator string(Unit)

Converts a unit value to a string.

implicit operator Unit(double)

Converts a double value to a Unit using Default units.

implicit operator Unit(int)

Converts an integer value to a Unit using Default units.

implicit operator Unit(string)

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

operator !=(Unit, Unit)

Tests whether the two unit values are not equal.

operator -(Unit, Unit)

Subtraction of two unit values.