ClassUnit
Represents a length measurement.
Definition
Namespace:Telerik.Reporting.Charting.Styles
Assembly:Telerik.Reporting.dll
Syntax:
[TypeConverter(typeof(UnitConverter))]
public class Unit
Inheritance: objectUnit
Constructors
Unit(UnitType)
Creates a class instance
Declaration
public Unit(UnitType type)
Parameters
type
UnitType specifies the target Unit type
Unit(double)
Initializes a new instance of the Unit with the specified double precision floating point number.
Declaration
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
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
Unit type
Unit(float)
Initializes a new instance of the Unit with the specified double precision floating point number.
Declaration
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
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
Unit type (Pixel / Percentage)
Unit(int)
Initializes a new instance of the Unit with the specified 32-bit signed integer.
Declaration
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
public Unit(int value, UnitType type)
Parameters
value
int
A 32-bit signed integer that represents the length of the Unit in pixels.
type
Unit type
Unit(string)
Initializes a new instance of the Unit with the specified length.
Declaration
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
public Unit(string value, CultureInfo culture)
Parameters
value
string
A string that represents the length of the Unit.
culture
CultureInfo
CultureInfo
Fields
Properties
IsEmpty
Gets whether Unit is empty
Declaration
public bool IsEmpty { get; }
Property Value
bool
Type
Gets or sets the unit type of the Unit.
Value
Gets or sets the length of the Unit.
Declaration
public float Value { get; set; }
Property Value
float
Methods
Equals(object)
Compares this Unit with the specified object.
Declaration
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
GetHashCode()
Returns a hash code for this Unit.
Declaration
public override int GetHashCode()
Returns
int
Hash code
Overrides
Parse(string)
Converts the specified string to a Unit.
Declaration
public static Unit Parse(string s)
Parameters
s
string
The string to convert.
Returns
A Unit that represents the specified string.
Parse(string, CultureInfo)
Declaration
public static Unit Parse(string s, CultureInfo culture)
Parameters
s
string
culture
CultureInfo
Returns
Percentage(double)
Creates a Unit of type Percentage from the specified double-precision floating-point number.
Declaration
public static Unit Percentage(double n)
Parameters
n
double
A double-precision floating-point number that represents the length of the Unit
Returns
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
public static Unit Pixel(float n)
Parameters
n
float
A 32-bit signed integer that represents the length of the Unit.
Returns
A Unit of type Pixel that represents the length specified by the n parameter.
ToString()
Base ToString override
Declaration
public override string ToString()
Returns
string
String representation of the Unit instance
Overrides
ToString(CultureInfo)
Base ToString override
Declaration
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
public static implicit operator Unit(float n)
Parameters
n
float
A float that represents the length of the Unit.
Returns
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.
operator ==(Unit, Unit)
Compares two Unit objects to determine whether they are equal.