Unit Structure

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Represents a length measurement.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[<Sealed>]
[<SerializableAttribute>]
[<TypeConverterAttribute(typeof(UnitConverter))>]
type Unit = struct end

NameDescription
System_CAPS_pubmethodUnit(Double)

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

System_CAPS_pubmethodUnit(Double, UnitType)

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

System_CAPS_pubmethodUnit(Int32)

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

System_CAPS_pubmethodUnit(String)

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

System_CAPS_pubmethodUnit(String, CultureInfo)

Initializes a new instance of the Unit structure with the specified length and System.Globalization.CultureInfo.

NameDescription
System_CAPS_pubpropertyIsEmpty

Gets a value indicating whether the Unit is empty.

System_CAPS_pubpropertyType

Gets the unit type of the Unit.

System_CAPS_pubpropertyValue

Gets the length of the Unit.

NameDescription
System_CAPS_pubmethodEquals(Object)

Compares this Unit with the specified object.(Overrides ValueType.Equals(Object).)

System_CAPS_pubmethodGetHashCode()

Returns the hash code for this instance.(Overrides ValueType.GetHashCode().)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticParse(String)

Converts the specified string to a Unit.

System_CAPS_pubmethodSystem_CAPS_staticParse(String, CultureInfo)

Converts the specified string and System.Globalization.CultureInfo to a Unit.

System_CAPS_pubmethodSystem_CAPS_staticPercentage(Double)

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

System_CAPS_pubmethodSystem_CAPS_staticPixel(Int32)

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

System_CAPS_pubmethodSystem_CAPS_staticPoint(Int32)

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

System_CAPS_pubmethodToString()

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

System_CAPS_pubmethodToString(CultureInfo)

Converts a Unit to a string equivalent in the specified culture.

System_CAPS_pubmethodToString(IFormatProvider)

Converts a Unit to a string equivalent using the specified format provider.

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticEmpty

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

NameDescription
System_CAPS_puboperatorSystem_CAPS_staticEquality(Unit, Unit)

Compares two Unit objects to determine whether they are equal.

System_CAPS_puboperatorSystem_CAPS_staticImplicit(Int32 to Unit)

Implicitly creates a Unit of type Pixel from the specified 32-bit unsigned integer.

System_CAPS_puboperatorSystem_CAPS_staticInequality(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.

System_CAPS_noteNote

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.

No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.

.NET Framework
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.

Return to top
Show: