WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStFactory class reference

CreateCustomFont

This method creates a font that can be later referenced by its id. Almost all the widgets allow the modification of it's font (See WStForm::SetFont for more information).

Ole declaration

VARIANT_BOOL CreateCustomFont(SHORT usId, 
			SHORT usHeight, 
			VARIANT_BOOL bBold, 
			VARIANT_BOOL bItalic, 
			VARIANT_BOOL bUnderlined, 
			LPCTSTR sFaceName, 
			SHORT usAlignment);

Parameters
usId
The id of the font. This id can be used later to modify the font of a widget using WStForm::SetFont.
usHeight
Specifies the height of the font's character.
bBold
Specifies the weight of the font. If this parameter is TRUE the font's weight is bold, the font's weight is normal otherwise.
bItalic
Specifies an italic font if set to TRUE.
bUnderlined
Specifies an underlined font if set to TRUE.
sFaceName
Specifies a string that specifies the typeface name of the font. The length of this string must not exceed 32 characters. If the length of the string exceeds the 32 characters, the face name used is Tahoma.
usAlignment
The font's alignment used on the widget. This parameter can be one of the following values found on the WSFontAlignment enumeration:
Return Value

On success, CreateCustomFont returns TRUE, FALSE otherwise. To get extended information, call WStError::GetLastErrorCode.

Remarks

On a WS_BUTTON the use of the alignment  WS_CENTER has the same effect as using the alignment WS_LEFT.

If the given font face name is not found, the mobile unit uses the first font that match the other given attributes.

Every time this method is called a transaction is sent to the mobile unit, so the creation of multiple fonts can take a few seconds.

Example
C#
using WirelessStudioOleWidgets;
WStFactory oFactory = new WStFactory();
oFactory.CreateCustomFont(3, 14, true, false, false, "Courier New",(short)WSFontAlignment.WS_LEFT); 	
Visual Basic 6 (Full Example: BasicPropertiesDemoModule.bas.txt)
Public wsForm As New WStForm
Public wsFactory As New WStFactory		
...
wsFactory.CreateCustomFont 3, 11, True, False, False, "Times New Roman", WS_LEFT
wsFactory.CreateCustomFont 4, 16, False, True, True, "Tahoma", WS_RIGHT
wsFactory.CreateCustomFont 5, 16, False, False, False, "Courier New", WS_CENTER
...
See also

WStWidget::SetFont | LoadExternalIcon

WStWiget class reference | WStForm class reference | WStFactory class reference | WStError class reference