संपादित करें

इसके माध्यम से साझा किया गया


Unit Constructors

Definition

Initializes a new instance of the Unit structure.

Overloads

Unit(Double)

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

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(Double, UnitType)

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

Unit(String, CultureInfo)

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

Unit(Double)

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

public:
 Unit(double value);
public Unit (double value);
new System.Web.UI.WebControls.Unit : double -> System.Web.UI.WebControls.Unit
Public Sub New (value As Double)

Parameters

value
Double

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

Exceptions

value is not between -32768 and 32767.

Remarks

Use this constructor to create and initialize a new instance of the Unit structure using the specified double precision floating point number.

The following table shows initial property values for an instance of Unit.

Property Initial Value
Type Pixel
Value The value specified by value.

Caution

If value is not between -32768 and 32767, an exception is thrown.

See also

Applies to

Unit(Int32)

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

public:
 Unit(int value);
public Unit (int value);
new System.Web.UI.WebControls.Unit : int -> System.Web.UI.WebControls.Unit
Public Sub New (value As Integer)

Parameters

value
Int32

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

Exceptions

value is not between -32768 and 32767.

Remarks

Use this constructor to create and initialize a new instance of the Unit structure using the specified 32-bit signed integer.

The following table shows initial property values for an instance of Unit.

Property Initial Value
Type Pixel
Value The value specified by value.

Caution

If value is not between -32768 and 32767, an exception is thrown.

See also

Applies to

Unit(String)

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

public:
 Unit(System::String ^ value);
public Unit (string value);
new System.Web.UI.WebControls.Unit : string -> System.Web.UI.WebControls.Unit
Public Sub New (value As String)

Parameters

value
String

A string that represents the length of the Unit.

Exceptions

The specified length is not between -32768 and 32767.

value is not a valid CSS-compliant unit expression.

Remarks

Use this constructor to create and initialize a new instance of the Unit structure using the specified length. The length is specified in two parts, the length's value and the length's unit type. For example, "200Cm" represents a length of 200 centimeters. You can use any valid CSS-compliant unit expression.

The following table lists the common unit types.

Unit type Description
Pixel Length in pixels.
Point Length in points. A point represents 1/72 of an inch.
Inch Length in inches.
Mm Length in millimeters.
Cm Length in centimeters.
Percentage Length as a percentage of the parent element.

The following table shows initial property values for an instance of Unit.

Property Initial Value
Type The unit type specified in value.
Value The value specified in value.

Caution

If value is not between -32768 and 32767, an exception is thrown.

See also

Applies to

Unit(Double, UnitType)

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

public:
 Unit(double value, System::Web::UI::WebControls::UnitType type);
public Unit (double value, System.Web.UI.WebControls.UnitType type);
new System.Web.UI.WebControls.Unit : double * System.Web.UI.WebControls.UnitType -> System.Web.UI.WebControls.Unit
Public Sub New (value As Double, type As UnitType)

Parameters

value
Double

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

type
UnitType

One of the UnitType enumeration values.

Exceptions

value is not between -32768 and 32767.

Remarks

Use this constructor to create and initialize a new instance of the Unit structure using the specified double precision floating point number and UnitType.

The following table shows initial property values for an instance of Unit.

Property Initial Value
Type The value of type.
Value The value specified by value.

Caution

If value is not between -32768 and 32767, an exception is thrown.

See also

Applies to

Unit(String, CultureInfo)

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

public:
 Unit(System::String ^ value, System::Globalization::CultureInfo ^ culture);
public Unit (string value, System.Globalization.CultureInfo culture);
new System.Web.UI.WebControls.Unit : string * System.Globalization.CultureInfo -> System.Web.UI.WebControls.Unit
Public Sub New (value As String, culture As CultureInfo)

Parameters

value
String

A string that represents the length of the Unit.

culture
CultureInfo

A CultureInfo that represents the culture.

Exceptions

The specified length is not between -32768 and 32767.

value is not a valid CSS-compliant unit expression.

Remarks

Use this constructor to create and initialize a new instance of the Unit structure using the specified length and System.Globalization.CultureInfo. The length is specified in two parts, the length's value and the length's unit type. For example, "200Cm" represents a length of 200 centimeters. You can use any valid CSS-compliant unit expression.

The following table lists the common unit types.

Unit type Description
Pixel Length in pixels.
Point Length in points. A point represents 1/72 of an inch.
Inch Length in inches.
Mm Length in millimeters.
Cm Length in centimeters.
Percentage Length as a percentage of the parent element.

The following table shows initial property values for an instance of Unit.

Property Initial Value
Type The unit type specified in value.
Value The value specified in value.

Caution

If value is not between -32768 and 32767, an exception is thrown.

See also

Applies to