Skip to content
FellippeHeitor edited this page Dec 19, 2016 · 17 revisions

The Font property holds the handle of the loaded font associated with a control. Must be set using the SetFont method and cannot be directly manipulated with QB64's builtin font commands.

Control(ControlID).Font = SetFont(FontName$, FontSize%, Attributes$)
  • FontName$ must reference a font file. Only TTF fonts are accepted.
    • If you don't specify a path, the current path is used.
    • In Windows, if a path isn't specified the default font location C:\Windows\Font is searched.
  • FontSize% is in pixels, not points.
  • Attributes$ follow QB64's _LOADFONT parameters, but notice that BOLD and ITALIC parameters mostly have no effect, as there is usually a separate font file rendered with such attributes for different fonts.
    • MONOSPACE will work to load a font with all characters having the same _FONTWIDTH.

You can also use QB64's builtin fonts (_FONT 16 or _FONT 8). To do so, specify only the FontSize% parameter:

Control(ControlID).Font = SetFont("", 8, "")
Control(ControlID).Font = SetFont("", 16, "")

To specify a font at design time, use the following syntax in the editor:

fontfile*attributes*size

The default font for controls is:

 segoeui.ttf**12

If you don't set a control's font property, it will inherit its container's font (either the main form or a frame, if any).

Controls that can use the Font property:

Clone this wiki locally