FontDescriptorFromFont method (WinStudio scripts)

Applies To

IWSApplication interface

Definition

Takes a Font data type as input and returns the value as a font descriptor string.

A "font descriptor" is a string consisting of a list of fourteen comma-separated values. For more information about this value, see the "Remarks" section.

Syntax

Application.FontDescriptorFromFont( Font.font )

Part Description
font Required. Name of a valid Font data type.

Remarks

The return value is a string consisting of a list of fourteen comma-separated values that define the font, using this format:

Size,0,0,0,Weight,Italic,Underline,Strikethrough,0,0,0,0,0,FontFamily

where:

List item: Consists of:
Size A decimal value representing the point size.
Weight Range from 0 (non-bold) to 700 (bold).
Italic 0 = Normal text 1 = Italicized text.
Underline 0 = Text not underlined. 1 = Text underlined.
Strikethrough 0 = Normal text. 1 = Text struck through.
FontFamily Name of the font (family) to be used.

This method must be used in conjunction with another method, such as SetGridRowColFont, SetGridRowColFontByColumnName, or any other method that requires a font descriptor as input. It allows you to construct the font descriptor from a Font data type.

When using this method, you must include the following comment above the Imports section in any global or form script:

'//<Ref>System.Drawing.dll</Ref>

Example

Sub Main()
   Dim FontDesc As String
   Dim newFont As Font 
   FontDesc = Application.GetBaseFontDescriptor()
   newFont = Application.FontFromFontDescriptor( FontDesc )
   If not IDONull.IsNull(newFont) Then 
        newFont = new Font( newFont, FontStyle.Bold )
        FontDesc = Application.FontDescriptorFromFont( newFont )  
   End If   
   ThisForm.Components("FormCollectionGrid").SetGridRowColFont( 3, 4, FontDesc, True )
End Sub
Rubriques liées