FontUnit Constructors

Definition

Initializes a new instance of the FontUnit class.

Overloads

FontUnit(Double)

Initializes a new instance of the FontUnit class with the specified font size in points.

FontUnit(Int32)

Initializes a new instance of the FontUnit class with the specified font size.

FontUnit(String)

Initializes a new instance of the FontUnit class with the specified string.

FontUnit(FontSize)

Initializes a new instance of the FontUnit class with the specified FontSize.

FontUnit(Unit)

Initializes a new instance of the FontUnit class with the specified Unit.

FontUnit(Double, UnitType)

Initializes a new instance of the FontUnit class with the specified font size and UnitType value.

FontUnit(String, CultureInfo)

Initializes a new instance of the FontUnit class with the specified string using the specified CultureInfo object.

FontUnit(Double)

Initializes a new instance of the FontUnit class with the specified font size in points.

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

Parameters

value
Double

A Double that specifies the font size.

Exceptions

value is outside the valid range.

Remarks

Use the FontUnit constructor to create and initialize an instance of the FontUnit class using the specified font size. The following table shows initial property values for the FontUnit object that is created.

Property Initial value
Type The AsUnit value.
Unit A Unit with the Value property equal to value and the Type property equal to the Point value.

See also

Applies to

FontUnit(Int32)

Initializes a new instance of the FontUnit class with the specified font size.

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

Parameters

value
Int32

The size of the font.

Remarks

Use this constructor to create and initialize a new instance of the FontUnit class using the specified font size.

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

Property Initial Value
Type FontSize.AsUnit
Unit A Unit with its Value property set to the font size specified by the value parameter.

See also

Applies to

FontUnit(String)

Initializes a new instance of the FontUnit class with the specified string.

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

Parameters

value
String

A string to specify the font size.

Remarks

The FontUnit constructor calls the FontUnit constructor, using the CurrentCulture property for the CultureInfo parameter.

See also

Applies to

FontUnit(FontSize)

Initializes a new instance of the FontUnit class with the specified FontSize.

public:
 FontUnit(System::Web::UI::WebControls::FontSize type);
public FontUnit (System.Web.UI.WebControls.FontSize type);
new System.Web.UI.WebControls.FontUnit : System.Web.UI.WebControls.FontSize -> System.Web.UI.WebControls.FontUnit
Public Sub New (type As FontSize)

Parameters

type
FontSize

One of the FontSize values.

Exceptions

The specified font size is not one of the FontSize values.

Remarks

Use this constructor to create and initialize a new instance of the FontUnit class using the specified FontSize object.

If the type parameter contains the value FontSize.AsUnit, the following table shows the initial property values for an instance of FontUnit.

Property Initial Value
Type FontSize.AsUnit
Unit A Unit object with its Value property set to 10.

If the type parameter contains any other FontSize value, the following table shows the initial property values for an instance of FontUnit.

Property Initial Value
Type The value of the type parameter.
Unit Empty

See also

Applies to

FontUnit(Unit)

Initializes a new instance of the FontUnit class with the specified Unit.

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

Parameters

value
Unit

A Unit that specifies the font size.

Remarks

Use this constructor to create and initialize a new instance of the FontUnit class using the specified Unit.

If the IsEmpty property of the Unit passed in the value parameter is true, the following table shows initial property values for an instance of FontUnit.

Property Initial Value
Type FontSize.NotSet
Unit Empty

If the IsEmpty property of the Unit passed in the value parameter is false, the following table shows initial property values for an instance of FontUnit.

Property Initial Value
Type FontSize.AsUnit
Unit The value of the value parameter.

See also

Applies to

FontUnit(Double, UnitType)

Initializes a new instance of the FontUnit class with the specified font size and UnitType value.

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

Parameters

value
Double

A Double that specifies the font size.

type
UnitType

A UnitType to specify the units of the size.

Exceptions

value is outside the valid range.

Remarks

Use the FontUnit constructor to create and initialize an instance of the FontUnit class using the specified font size and measuring unit, such as point or pixel.

The following table shows the initial property values for a FontUnit object.

Property Initial Value
Type The AsUnit value.
Unit A Unit with the Value property equal to value and the Type property equal to type.

See also

Applies to

FontUnit(String, CultureInfo)

Initializes a new instance of the FontUnit class with the specified string using the specified CultureInfo object.

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

Parameters

value
String

A string to specify the font size.

culture
CultureInfo

A CultureInfo used to make string comparisons.

Remarks

The FontUnit constructor recognizes the strings for value that are shown in the following table to create a new instance of the FontUnit class.

String value FontUnit
xx-small, xxsmall XXSmall
x-small, xsmall XSmall
x-large, xlarge XLarge
xx-large, xxlarge XXLarge
small Small
smaller Smaller
large Large
larger Larger
medium Medium

In all cases, the Type property has the value NotSet. The string comparison is case insensitive.

For all other values of value, a new instance of the FontUnit class is created by treating value as a font size and setting the Type property to Point.

See also

Applies to