System.Web.UI.WebControls.Unit Structure

Represents a length measurement.

See Also: Unit Members


public struct Unit


The System.Web.UI.WebControls.Unit structure represents a length measurement that can be expressed in any HTML-compatible size unit. The System.Web.UI.WebControls.UnitType enumeration lists the units of measurement that can be represented. The System.Web.UI.WebControls.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 WebControl.BorderWidth property of a Web Server control to a System.Web.UI.WebControls.Unit that represents five pixels.


The System.Web.UI.WebControls.Unit class can represent values only between -32768 and 32767.

Use the Unit.Value property to determine the length of the measurement. The unit of measurement is determined using the Unit.Type property. You can convert other data types to a System.Web.UI.WebControls.Unit by using the Unit.Parse(string), Unit.Percentage(double), Unit.Pixel(int), and Unit.Point(int) methods.

For a list of initial property values for an instance of System.Web.UI.WebControls.Unit, see the System.Web.UI.WebControls.Unit constructor.


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