#include <Misc.au3>
Global $INI = @ScriptDir & '\Settings.ini'
Global $Italic = False, $Underline = False, $Strikethru = False
If FileExists($INI) Then
$ColorREF = IniRead($INI, 'Font', 'ColorREF', '')
$Size = IniRead($INI, 'Font', 'Size', '')
$Weight = IniRead($INI, 'Font', 'Width', '')
$Attribute = IniRead($INI, 'Font', 'Atributte', '')
$Name = IniRead($INI, 'Font', 'Name', '')
$Color = IniRead($INI, 'Font', 'Color', '')
EndIf
$GUI = GUICreate("Test", 306, 135)
$Label1 = GUICtrlCreateLabel("Hello world !!!", 32, 24, 259, 42)
If FileExists($INI) Then
GUICtrlSetFont(-1, $Size, $Weight, $Attribute, $Name)
GUICtrlSetColor(-1, $Color)
EndIf
$Button1 = GUICtrlCreateButton("Шрифт", 112, 88, 75, 25)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $Button1
Switch $Attribute
Case 2
$Italic = True
Case 10
$Italic = True
$Strikethru = True
Case 8
$Strikethru = True
case 4
$Underline = True
Case 6
$Italic = True
$Underline = True
Case 12
$Underline = True
$Strikethru = True
Case 14
$Italic = True
$Underline = True
$Strikethru = True
EndSwitch
$Font = _ChooseFont($Name, $Size, $ColorREF, $Weight, $Italic, $Underline, $Strikethru, $GUI)
If @error Then ContinueLoop
GUICtrlSetFont($Label1, $Font[3], $Font[4], $Font[1], $Font[2])
GUICtrlSetColor($Label1, $Font[7])
IniWrite($INI, 'Font', 'Size', $Font[3])
IniWrite($INI, 'Font', 'Width', $Font[4])
IniWrite($INI, 'Font', 'Atributte', $Font[1])
IniWrite($INI, 'Font', 'Name', $Font[2])
IniWrite($INI, 'Font', 'Color', $Font[7])
IniWrite($INI, 'Font', 'ColorREF', $Font[5])
EndSwitch
WEnd