Class
Unit

Represents a length measurement.

Definition

Namespace:Telerik.Charting.Styles

Assembly:Telerik.WinControls.RadChart.dll

Syntax:

cs-api-definition
[TypeConverter(typeof(UnitConverter))]
public class Unit

Inheritance: objectUnit

Constructors

Unit()

Creates a class instance

Declaration

cs-api-definition
public Unit()

Unit(UnitType)

Creates a class instance

Declaration

cs-api-definition
public Unit(UnitType type)

Parameters

type

UnitType

UnitType specifies the target Unit type

Unit(double)

Initializes a new instance of the Unit with the specified double precision floating point number.

Declaration

cs-api-definition
public Unit(double value)

Parameters

value

double

A double precision floating point number that represents the length of the Unit in pixels.

Unit(double, UnitType)

Initializes a new instance of the Unit with the specified double precision floating point number and the target type

Declaration

cs-api-definition
public Unit(double value, UnitType type)

Parameters

value

double

A double precision floating point number that represents the length of the Unit in pixels.

type

UnitType

Unit type

Unit(float)

Initializes a new instance of the Unit with the specified double precision floating point number.

Declaration

cs-api-definition
public Unit(float value)

Parameters

value

float

A float precision floating point number that represents the length of the Unit in pixels.

Unit(float, UnitType)

Initializes a new instance of the Unit with the specified double precision floating point number and the target type.

Declaration

cs-api-definition
public Unit(float value, UnitType type)

Parameters

value

float

A float precision floating point number that represents the length of the Unit in pixels.

type

UnitType

Unit type (Pixel / Percentage)

Unit(int)

Initializes a new instance of the Unit with the specified 32-bit signed integer.

Declaration

cs-api-definition
public Unit(int value)

Parameters

value

int

A 32-bit signed integer that represents the length of the Unit in pixels.

Unit(int, UnitType)

Initializes a new instance of the Unit with the specified 32-bit signed integer and the target type

Declaration

cs-api-definition
public Unit(int value, UnitType type)

Parameters

value

int

A 32-bit signed integer that represents the length of the Unit in pixels.

type

UnitType

Unit type

Unit(string)

Initializes a new instance of the Unit with the specified length.

Declaration

cs-api-definition
public Unit(string value)

Parameters

value

string

A string that represents the length of the Unit.

Unit(string, CultureInfo)

Initializes a new instance of the Unit with the specified length.

Declaration

cs-api-definition
public Unit(string value, CultureInfo culture)

Parameters

value

string

A string that represents the length of the Unit.

culture

CultureInfo

CultureInfo

Fields

Empty

Represents an empty Unit. This field is read-only.

Declaration

cs-api-definition
public static readonly Unit Empty

Field Value

Unit

Properties

IsEmpty

Gets whether Unit is empty

Declaration

cs-api-definition
public bool IsEmpty { get; }

Property Value

bool

Type

Gets or sets the unit type of the Unit.

Declaration

cs-api-definition
public UnitType Type { get; set; }

Property Value

UnitType

Value

Gets or sets the length of the Unit.

Declaration

cs-api-definition
public float Value { get; set; }

Property Value

float

Methods

Equals(object)

Compares this Unit with the specified object.

Declaration

cs-api-definition
public override bool Equals(object obj)

Parameters

obj

object

The specified object for comparison.

Returns

bool

true if the Unit that this method is called from is equal to the specified object; otherwise, false.

Overrides object.Equals(object)

GetHashCode()

Returns a hash code for this Unit.

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

Hash code

Overrides object.GetHashCode()

Parse(string)

Converts the specified string to a Unit.

Declaration

cs-api-definition
public static Unit Parse(string s)

Parameters

s

string

The string to convert.

Returns

Unit

A Unit that represents the specified string.

Parse(string, CultureInfo)

Declaration

cs-api-definition
public static Unit Parse(string s, CultureInfo culture)

Parameters

s

string

culture

CultureInfo

Returns

Unit

Percentage(double)

Creates a Unit of type Percentage from the specified double-precision floating-point number.

Declaration

cs-api-definition
public static Unit Percentage(double n)

Parameters

n

double

A double-precision floating-point number that represents the length of the Unit

Returns

Unit

A Unit of type Percentage that represents the length specified by the double-precision floating-point number.

Pixel(float)

Creates a Unit of type Pixel from the specified 32-bit signed integer.

Declaration

cs-api-definition
public static Unit Pixel(float n)

Parameters

n

float

A 32-bit signed integer that represents the length of the Unit.

Returns

Unit

A Unit of type Pixel that represents the length specified by the n parameter.

ToString()

Base ToString override

Declaration

cs-api-definition
public override string ToString()

Returns

string

String representation of the Unit instance

Overrides object.ToString()

ToString(CultureInfo)

Base ToString override

Declaration

cs-api-definition
public string ToString(CultureInfo culture)

Parameters

culture

CultureInfo

CultureInfo

Returns

string

String representation of the Unit instance

Operators

implicit operator Unit(float)

Implicitly creates a Unit of type Pixel from the specified float.

Declaration

cs-api-definition
public static implicit operator Unit(float n)

Parameters

n

float

A float that represents the length of the Unit.

Returns

Unit

A Unit of type Pixel that represents the specified by the n parameter.

operator !=(Unit, Unit)

Compares two Unit objects to determine whether they are not equal.

Declaration

cs-api-definition
public static bool operator !=(Unit left, Unit right)

Parameters

left

Unit

The Unit on the left side of the operator.

right

Unit

The Unit on the right side of the operator.

Returns

bool

true if the Unit objects are not equal; otherwise, false.

operator ==(Unit, Unit)

Compares two Unit objects to determine whether they are equal.

Declaration

cs-api-definition
public static bool operator ==(Unit left, Unit right)

Parameters

left

Unit

The Unit on the left side of the operator.

right

Unit

The Unit on the right side of the operator.

Returns

bool

true if both Unit objects are equal; otherwise, false.