Return or set font styles in the following formats: Bold, Italic, Strikethru, and Underline.
[object.]FontBold [= boolean]
[object.]FontItalic [= boolean]
[object.]FontName [= string]
[object.]FontSize [= single]
[object.]FontStikethru [= boolean]
[object.]FontTransparent [= boolean]
[object.]FontUnderline [= boolean]
object:Ocx Object (controls, Form, and Printer)
Use these font properties to format text, either at design time using the Properties window or at run time using code. For Form and Printer objects, setting these properties doesn't affect graphics or text already drawn on the control or object. For all other controls, font changes take effect on screen immediately.
FontSize takes a Short specifying the size of the font in dots/inch.
FontTransparent returns or sets a Boolean value that determines whether background text and graphics on a Form or Printer object are displayed in the spaces around characters.
Ocx Label lbl = "Example Text", 10, 10, 100, 20
Ocx Command bld = "Bold", 10, 40, 80, 22
Ocx Command itl = "Italic", 100, 40, 80, 22
Ocx Command und = "Underline", 190, 40, 80, 22
Do : Sleep : Until Me Is Nothing
Sub bld_Click
If bld.Caption = "Bold"
bld.Caption = "Not Bold" : lbl.FontBold = True
Else
bld.Caption = "Bold" : lbl.FontBold = False
EndIf
EndSub
Sub itl_Click
If itl.Caption = "Italic"
itl.Caption = "Not Italic" : lbl.FontItalic = True
Else
itl.Caption = "Italic" : lbl.FontItalic = False
EndIf
EndSub
Sub und_Click
If und.Caption = "Underline"
und.Caption = "No Underline" : lbl.FontUnderline = True
Else
und.Caption = "Underline" : lbl.FontUnderline = False
EndIf
EndSub
FontTransparent is the same a GraphMode:
GraphMode , TRANSPARENT FontTransparent = True
GraphMode, OPAQUE FontTransparent = False
Note: When changing FontName, you may inadvertantly change the FontSize as well if the new font does not support the current size: when this happens, GFA-BASIC32 will automatically change FontSize to the closest legal for the new font. To prevent any nasty surprises, it is thus advisable to assign the FontName first and then specify the FontSize.
{Created by Sjouke Hamstra; Last updated: 16/05/2020 by James Gaite}