Unit Structure
Represents a length measurement.
Assembly: System.Web (in System.Web.dll)
| Name | Description | |
|---|---|---|
![]() | Unit(Double) | Initializes a new instance of the Unit structure with the specified double precision floating point number. |
![]() | Unit(Double, UnitType) | Initializes a new instance of the Unit structure with the specified double precision floating point number and UnitType. |
![]() | Unit(Int32) | Initializes a new instance of the Unit structure with the specified 32-bit signed integer. |
![]() | Unit(String^) | Initializes a new instance of the Unit structure with the specified length. |
![]() | Unit(String^, CultureInfo^) | Initializes a new instance of the Unit structure with the specified length and System.Globalization::CultureInfo. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | Compares this Unit with the specified object.(Overrides ValueType::Equals(Object^).) |
![]() | GetHashCode() | Returns the hash code for this instance.(Overrides ValueType::GetHashCode().) |
![]() | GetType() | |
![]() ![]() | Parse(String^) | Converts the specified string to a Unit. |
![]() ![]() | Parse(String^, CultureInfo^) | Converts the specified string and System.Globalization::CultureInfo to a Unit. |
![]() ![]() | Percentage(Double) | Creates a Unit of type Percentage from the specified double-precision floating-point number. |
![]() ![]() | Pixel(Int32) | Creates a Unit of type Pixel from the specified 32-bit signed integer. |
![]() ![]() | Point(Int32) | Creates a Unit of type Point from the specified 32-bit signed integer. |
![]() | ToString() | This API supports the product infrastructure and is not intended to be used directly from your code. Converts a Unit to a System::String.(Overrides ValueType::ToString().) |
![]() | ToString(CultureInfo^) | Converts a Unit to a string equivalent in the specified culture. |
![]() | ToString(IFormatProvider^) | Converts a Unit to a string equivalent using the specified format provider. |
| Name | Description | |
|---|---|---|
![]() ![]() | Equality(Unit, Unit) | Compares two Unit objects to determine whether they are equal. |
![]() ![]() | Implicit(Int32 to Unit) | Implicitly creates a Unit of type Pixel from the specified 32-bit unsigned integer. |
![]() ![]() | Inequality(Unit, Unit) | Compares two Unit objects to determine whether they are not equal. |
The Unit structure represents a length measurement that can be expressed in any HTML-compatible size unit. The UnitType enumeration lists the units of measurement that can be represented. The Unit is used by properties such as BorderWidth and Height to represent the length or width of the property. For example, you can set the BorderWidth property of a Web Server control to a Unit that represents five pixels.
Note |
|---|
The Unit class can represent values only between -32768 and 32767. |
Use the Value property to determine the length of the measurement. The unit of measurement is determined using the Type property. You can convert other data types to a Unit by using the Parse, Percentage, Pixel, and Point methods.
For a list of initial property values for an instance of Unit, see the Unit constructor.
The following code example demonstrates how to use a Style object to change the style properties of multiple controls at once. Each time one of the Style property values changes, each control must call its ApplyStyle method. Note that not all the controls support all the properties demonstrated. If a control does not support a particular property, the appearance of the control will not change when the property value is changed.
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.





