skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Use Reports in Applications
    • System Requirements
    • Forums
    • Videos
    • Blogs
    • Submit a Ticket
    • FAQs
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now
Search all

Class Unit

Represents a length measurement.

Inheritance
System.Object
Unit
Namespace: Telerik.Reporting.Charting.Styles
Assembly: Telerik.Reporting.dll

Syntax

public class Unit

Constructors

Unit()

Creates a class instance

Declaration
public Unit()

Unit(Double)

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

Declaration
public Unit(double value)
Parameters
System.Double value

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
System.Double value

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

UnitType type

Unit type

Unit(Int32)

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

Declaration
public Unit(int value)
Parameters
System.Int32 value

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

Unit(Int32, 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
System.Int32 value

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

UnitType type

Unit type

Unit(Single)

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

Declaration
public Unit(float value)
Parameters
System.Single value

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

Unit(Single, 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
System.Single value

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

UnitType type

Unit type (Pixel / Percentage)

Unit(String)

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

Declaration
public Unit(string value)
Parameters
System.String value

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
System.String value

A string that represents the length of the Unit.

System.Globalization.CultureInfo culture

CultureInfo

Unit(UnitType)

Creates a class instance

Declaration
public Unit(UnitType type)
Parameters
UnitType type

UnitType specifies the target Unit type

Fields

Empty

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

Declaration
public static readonly Unit Empty
Field Value
Unit

Properties

IsEmpty

Gets whether Unit is empty

Declaration
public bool IsEmpty { get; }
Property Value
System.Boolean

Type

Gets or sets the unit type of the Unit.

Declaration
public UnitType Type { get; set; }
Property Value
UnitType

Value

Gets or sets the length of the Unit.

Declaration
public float Value { get; set; }
Property Value
System.Single

Methods

Equals(Object)

Compares this Unit with the specified object.

Declaration
public override bool Equals(object obj)
Parameters
System.Object obj

The specified object for comparison.

Returns
System.Boolean

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

Overrides
System.Object.Equals(System.Object)

GetHashCode()

Returns a hash code for this Unit.

Declaration
public override int GetHashCode()
Returns
System.Int32

Hash code

Overrides
System.Object.GetHashCode()

Parse(String)

Converts the specified string to a Unit.

Declaration
public static Unit Parse(string s)
Parameters
System.String s

The string to convert.

Returns
Unit

A Unit that represents the specified string.

Parse(String, CultureInfo)

Declaration
public static Unit Parse(string s, CultureInfo culture)
Parameters
System.String s

System.Globalization.CultureInfo culture

Returns
Unit

Percentage(Double)

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

Declaration
public static Unit Percentage(double n)
Parameters
System.Double n

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(Single)

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

Declaration
public static Unit Pixel(float n)
Parameters
System.Single n

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
public override string ToString()
Returns
System.String

String representation of the Unit instance

Overrides
System.Object.ToString()

ToString(CultureInfo)

Base ToString override

Declaration
public string ToString(CultureInfo culture)
Parameters
System.Globalization.CultureInfo culture

CultureInfo

Returns
System.String

String representation of the Unit instance

Operators

Equality(Unit, Unit)

Compares two Unit objects to determine whether they are equal.

Declaration
public static bool operator ==(Unit left, Unit right)
Parameters
Unit left

The Unit on the left side of the operator.

Unit right

The Unit on the right side of the operator.

Returns
System.Boolean

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

Implicit(Single to Unit)

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

Declaration
public static implicit operator Unit(float n)
Parameters
System.Single n

A float that represents the length of the Unit.

Returns
Unit

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

Inequality(Unit, Unit)

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

Declaration
public static bool operator !=(Unit left, Unit right)
Parameters
Unit left

The Unit on the left side of the operator.

Unit right

The Unit on the right side of the operator.

Returns
System.Boolean

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

Getting Started
  • Install Now
  • Online Demos
Support Resources
  • Documentation
  • Knowledge Base
  • Videos
  • Reporting Samples Repository
  • Reporting Release History
Community
  • Forums
  • Blogs
  • Reporting Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.