Programming Reference Manual
 
Syntax
 
DlgCreateFont(FontName[, FontHeight][, FontWidth][, Bold][, Italic][, _
                                               Underline][, StrikeThru])
 
Description
Create an instance of a new font object and return the Fontname  Windows handle from the newly created font.
 
Font objects are used in dialog boxes to change the appearance of the dialog items. The returned handle should be stored in a module-level or global-level declared variable, so it's value can be read from within a dialogfunc routine.
 
Parameter
Description
FontName 
The family name of the font to be created. Required.
FontHeight
Optional. The size of the font in point. Default value=10
FontWidth
Optional. Changes the width of the font. Default value=0 which means: do not change
Note: not all font families support alternate width settings.
Bold
Optional. Make the font bold
Note: not all font families support bold settings.
Italic
Optional. Set the font in italic
Underline
Optional. Underlines the font characters
StrikeThru
Optional. Make the characters appear with strike through.
See Also
Example
 
Dim hFont As Long
 
Sub Main
 
   Begin Dialog UserDialog 400,203,"FontTest",.userFunction ' %GRID:10,7,1,1
      Text 30,14,100,35,"Text1",.Text1
      TextBox 150,14,110,35,.TextBox1
      OKButton 90,70,90,21
   End Dialog
   Dim dlg As UserDialog
 
   hFont = DlgCreateFont("FixedSys")
 
   Dialog dlg
 
   DlgDeleteFont hFont
 
End Sub
 
 
Private Function userFunction(DlgItem$, Action%, SuppValue&) As Boolean
   Select Case Action%
      Case 1 ' Dialog box initialization
         DlgSetFont  SuppValue, DlgControlId("Text1"), hFont
 
      Case 2 ' Value changing or button pressed
      Case 3 ' TextBox or ComboBox text changed
      Case 4 ' Focus changed
      Case 5 ' Idle
      Case 6 ' Function key
   End Select
End Function