#include #include #include #Region ### START Koda GUI section ### Form= ;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling): #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /rm /pe ;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling()) #AutoIt3Wrapper_Res_HiDpi=y #NoTrayIcon #include "MetroGUI-UDF\MetroGUI_UDF.au3" Opt("GUIonEventMode", 1) Global $Radio[2] _SetTheme("DarkBlue") ;See MetroThemes.au3 for selectable themes or to add more ;Enable high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp. _Metro_EnableHighDPIScaling() ; Note: Requries "#AutoIt3Wrapper_Res_HiDpi=y" for compiling. To see visible changes without compiling, you have to disable dpi scaling in compatibility settings of Autoit3.exe ;Create resizable Metro GUI $Form1 = _Metro_CreateGUI("Example", 500, 300, -1, -1, True) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ;Set min size for the gui (optional/only for resize) _GUI_DragAndResizeUpdate($Form1, 500, 300) ;Add/create control buttons to the gui $Control_Buttons = _Metro_AddControlButtons(True, True, True, True, True) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True ;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected. $GUI_CLOSE_BUTTON = $Control_Buttons[0] $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1] $GUI_RESTORE_BUTTON = $Control_Buttons[2] $GUI_MINIMIZE_BUTTON = $Control_Buttons[3] $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4] $GUI_FSRestore_BUTTON = $Control_Buttons[5] $GUI_MENU_BUTTON = $Control_Buttons[6] ;====================================================================================================================================================================== ;Create Buttons $Button1 = _Metro_CreateButton("Button Style 1", 105, 240, 130, 40) $Button2 = _Metro_CreateButtonEx("Button Style 2", 255, 240, 130, 40) GUICtrlSetOnEvent(-1,"_button") ;Create Checkboxes $Checkbox1 = _Metro_CreateCheckbox("Checkbox 1", 30, 70, 125, 30) GUICtrlSetOnEvent(-1,"_checkbox") $Checkbox2 = _Metro_CreateCheckboxEx("Checkbox 2", 30, 107, 125, 30) GUICtrlSetOnEvent(-1,"_checkbox") _Metro_CheckboxCheck($Checkbox1) _Metro_CheckboxCheck($Checkbox2) ;Create 2 Radios that are assigned to Radio Group 1 $Radio1 = _Metro_CreateRadio("1", "Radio 1", 180, 70, 100, 30) GUICtrlSetOnEvent(-1, "_Radio") $Radio2 = _Metro_CreateRadio("1", "Radio 2", 180, 110, 100, 30) GUICtrlSetOnEvent(-1, "_Radio") _Metro_RadioCheck("1", $Radio1) ;check $Radio1 which is assigned to radio group "1" and uncheck any other radio in group "1" ;Create Toggle $Toggle1 = _Metro_CreateToggle("Toggle 1", 320, 70, 130, 30) ; $Toggle2 = _Metro_CreateToggleEx("Toggle 2", 322, 107, 128, 30) ; ;Create Progressbar $Progress1 = _Metro_CreateProgress(100, 180, 300, 26) ;Create an Array containing menu button names Dim $MenuButtonsArray[4] = ["Settings", "About", "Contact", "Exit"] ;Set resizing options for the controls so they don't change in size or position. This can be customized to match your gui perfectly for resizing. See AutoIt Help file. GUICtrlSetResizing($Button1, 768 + 8) GUICtrlSetResizing($Button2, 768 + 8) GUICtrlSetResizing($Checkbox1, 768 + 2 + 32) GUICtrlSetResizing($Checkbox2, 768 + 2 + 32) GUICtrlSetResizing($Radio1, 768 + 2 + 32) GUICtrlSetResizing($Radio2, 768 + 2 + 32) GUICtrlSetResizing($Toggle1, 768 + 2 + 32) GUICtrlSetResizing($Toggle2, 768 + 2 + 32) GUICtrlSetResizing($Progress1[0], 768 + 2 + 32) GUISetState(@SW_SHOW) While 1 _Metro_HoverCheck_Loop($Form1) Sleep(10) WEnd Func _Radio() If GUICtrlRead($Radio[0]) = 1 Then GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Checkbox1, $GUI_DISABLE) Else GUICtrlSetState($Checkbox1, $GUI_ENABLE) GUICtrlSetState($Button1, $GUI_DISABLE) EndIf EndFunc Func _checkbox() If _Metro_CheckboxIsChecked($Checkbox1) Then _Metro_CheckboxUnCheck($Checkbox1) ConsoleWrite("Checkbox unchecked!" & @CRLF) Else _Metro_CheckboxCheck($Checkbox1) ConsoleWrite("Checkbox checked!" & @CRLF) EndIf EndFunc Func _button() _Metro_GUIDelete($Form1) _Metro_MsgBox(0, "Metro MsgBox Example", "Button 2 clicked.", 400, 11, $Form1) EndFunc Func _Exit() _Metro_GUIDelete($Form1) Exit EndFunc