TFont.Style

Applies to TestComplete 14.10, last modified on June 5, 2019

Specifies the font style.

Declaration

TFontObj.Style
Read-Write Property Variant
TFontObj     A TFont object  

Description

The TFont.Style property allows you to obtain or set the style of the font used to display the component’s text. The font style is a combination of style attributes. Using this property you can determine whether the text characters will be normal, bold-faced, italicized, underlined, striked out.

Return Value

One of the constants listed in the following table, or their combination (see Remarks).

Constant Description
"fsBold" or 1 A bold-faced font.
"fsItalic" or 2 An italic font.
"fsUnderline" or 4 An underlined font.
"fsStrikeOut" or 8 A strikeout font.

Remarks

To set the Style property value from the User Forms editor, set the property flags corresponding to the needed style attribute value to True. In the User Forms editor, the Style property value is displayed as a string that includes a combination of style attribute values separated by commas and enclosed in square brackets.

In scripts, you can set the property value by assigning the appropriate constant or their combination.

To combine integer values, use the bitwise OR operator:

JavaScript, JScript

UserForms.MyForm.MyComponent.Style.Font.Style = 1 | 4;

Python

UserForms.MyForm.MyComponent.Style.Font.Style = 1 | 4

VBScript

UserForms.MyForm.MyComponent.Style.Font.Style = 1 Or 4

DelphiScript

UserForms.MyForm.MyComponent.Style.Font.Style := 1 or 4;

C++Script, C#Script

UserForms["MyForm"]["MyComponent"]["Style"]["Font"]["Style"] = 1 | 4;

To combine string values, separate them by commas or spaces, and optionally enclose the resulting string in square brackets. That is, use one of the following variants:

UserForms.MyForm.MyComponent.Font.Style = "fsBold,fsUnderline";
UserForms.MyForm.MyComponent.Style.Font.Style = "fsBold fsUnderline";
UserForms.MyForm.MyComponent.Style.Font.Style = "fsBold, fsUnderline";
UserForms.MyForm.MyComponent.Style.Font.Style = "[fsBold,fsUnderline]";
UserForms.MyForm.MyComponent.Style.Font.Style = "[fsBold fsUnderline]";
UserForms.MyForm.MyComponent.Style.Font.Style = "[fsBold, fsUnderline]";

See Also

TFont.Charset
TFont.Color
TFont.Height
TFont.Name
TFont.Pitch
TFont.Size

Highlight search results