# Function Reference

GUICtrlSetFont

Sets the font for a control.

GUICtrlSetFont (controlID, size [, weight [, attribute [, fontname]]] )

Parameters

controlID | The control identifier (controlID) as returned by a GUICtrlCreate... function.
size | Fontsize (default is 9).
weight | [optional] Font weight (default 400 = normal).
attribute | [optional] To define italic:2 underlined:4 strike:8 char format (add together the values of all the styles required, 2+4 = italic and underlined).
fontname | [optional] The name of the font to use.

Return Value

Success: | Returns 1.
Failure: | Returns 0.

Remarks

By default, controls use the font set by GUISetFont.
Size can contain a decimal as in 8.5.
See the Appendix for a complete list of Windows fonts and the Windows versions under which they are supported.

Related

GUICtrlCreate..., GUISetFont

Example

#include <GUIConstants.au3>
GUICreate ("My GUI") ; will create a dialog box that when displayed is centered
$font="Comic Sans MS"
GUICtrlCreateLabel ("underlined label",10,20)
GUICtrlSetFont (-1,9, 400, 4, $font) ; will display underlined characters
GUICtrlCreateLabel ("italic label", 10,40)
GUICtrlSetFont (-1,9, 400, 2, $font) ; will display italic characters
GUISetFont (9, 400, 8, $font) ; will display strike characters
GUICtrlCreateLabel ("strike label",10,60)
GUISetState () ; will display an empty dialog box
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend