├── DLGUI.au3 ├── DLGUI_stripped.au3 ├── DataLoc_x64.exe ├── DataLoc_x86.exe ├── LICENSE └── Lib ├── Cake.ico └── MetroGUI-UDF ├── MetroGUI_UDF.au3 ├── MetroThemes.au3 └── MetroUDF-Required ├── BorderLessWinUDF.au3 ├── StringSize.au3 └── _GUIDisable.au3 /DataLoc_x64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetSPI/DataLoc/5ce9238997d30510a1d5560328777a669fd0ca51/DataLoc_x64.exe -------------------------------------------------------------------------------- /DataLoc_x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetSPI/DataLoc/5ce9238997d30510a1d5560328777a669fd0ca51/DataLoc_x86.exe -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | dataLoc is provided under the 3-clause BSD license below. 2 | 3 | ************************************************************* 4 | 5 | Copyright (c) 2017, NetSPI 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | 14 | * Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | * Neither the name of dataLoc nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /Lib/Cake.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetSPI/DataLoc/5ce9238997d30510a1d5560328777a669fd0ca51/Lib/Cake.ico -------------------------------------------------------------------------------- /Lib/MetroGUI-UDF/MetroGUI_UDF.au3: -------------------------------------------------------------------------------- 1 | ; #UDF# ======================================================================================================================= 2 | ; Name ..........: MetroGUI UDF 3 | ; Description ...: Create borderless GUIs with modern buttons, checkboxes, toggles, radios MsgBoxes and progressbars. 4 | ; Version .......: v4.3 5 | ; Author ........: BB_19 6 | ; Note: 7 | ; =============================================================================================================================== 8 | 9 | #include-once 10 | #include "MetroThemes.au3" 11 | #include "MetroUDF-Required\BorderlessWinUDF.au3" 12 | #include "MetroUDF-Required\StringSize.au3" 13 | #include "MetroUDF-Required\_GUIDisable.au3" 14 | #include 15 | _GDIPlus_Startup() 16 | 17 | ;Global Variables 18 | Global $Font_DPI_Ratio = _SetFont_GetDPI()[2], $gDPI = _GDIPlus_GraphicsGetDPIRatio(), $HIGHDPI_SUPPORT = False 19 | Global $GUI_TOP_MARGIN = Number(29 * $gDPI, 1) + Number(15 * $gDPI, 1) 20 | Global $GLOBAL_HOVER_REG[0] 21 | Global $Internal_MsgBoxTimeout = 0 22 | 23 | #Region Metro Functions Overview 24 | ;========================================MAIN GUI================================================== 25 | ;_Metro_CreateGUI - Creates a borderless Metro-Style GUI 26 | ;_SetTheme - Sets the GUI color scheme from the included MetroThemes.au3 27 | ;_Metro_AddControlButtons - Adds the selected control buttons to the gui. (Close,Maximize,Minimize,Fullscreen Toogle, Menu button) 28 | ;_Metro_HoverCheck_Loop - Enables hover effects for all metro style buttons, checkboxes etc. - Has to be added to the main while-loop. 29 | ;_Metro_GUIDelete - Destroys all created metro buttons,checkboxes,radios etc., deletes the GUI and reduces memory usage. 30 | ;_Metro_EnableHighDPIScaling - Enables high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp. 31 | ;_Metro_SetGUIOption - Allows to set different options like dragmove, resize and min. resize width/height. 32 | ;_Metro_FullscreenToggle - Toggles between fullscreen and normal window. NOTE: $AllowResize has to be set True when creating a gui and this also requires the creation of a fullscreen control button. 33 | ;_Metro_AddControlButton_Back - Creates a back button on the left+top side of the gui. 34 | ;_Metro_MenuStart - Shows/creates a menu window that slides in from the right side of the gui. (Similar to Android menus or Windows 10 calculator app) 35 | 36 | ;==========================================Buttons================================================= 37 | ;_Metro_CreateButton - Creates metro style buttons. Hovering creates a frame around the buttons. 38 | ;_Metro_CreateButtonEx - Creates Windows 10 style buttons with a frame around. Hovering changes the button color to a lighter color. 39 | ;_Metro_DisableButton - Disables a metro button and adds a grayed out look to it. 40 | ;_Metro_EnableButton - Enables a metro button and removes grayed out look of it. 41 | 42 | ;==========================================Toggles================================================= 43 | ;_Metro_CreateToggle - Creates a Windows 10 style toggle with a text on the right side.(NEW Style) 44 | ;_Metro_CreateToggleEx - Creates a Windows 8 style toggle with a text on the right side. 45 | ;_Metro_ToggleIsChecked - Checks if a toggle is checked or not. Returns True or False. 46 | ;_Metro_ToggleCheck - Checks/Enables a toggle. 47 | ;_Metro_ToggleUnCheck - Unchecks/Disables a toggle. 48 | 49 | ;===========================================Radios================================================= 50 | ;_Metro_CreateRadio - Creates a metro style radio. 51 | ;_Metro_RadioCheck - Checks the selected radio and unchecks all other radios in the selected group. 52 | ;_Metro_RadioIsChecked - Checks if the radio in a specific group is selected. 53 | 54 | ;==========================================Checkboxes============================================== 55 | ;_Metro_CreateCheckbox - Creates a modern looking checkbox. 56 | ;_Metro_CreateCheckboxEx - Creates a classic-style checkbox with the default black white colors. 57 | ;_Metro_CheckboxIsChecked - Checks if a checkbox is checked. Returns True or False. 58 | ;_Metro_CheckboxCheck - Checks a checkbox. 59 | ;_Metro_CheckboxUncheck - Unchecks a checkbox. 60 | 61 | ;=============================================MsgBox=============================================== 62 | ;_Metro_MsgBox - Creates a MsgBox with a OK button and displays the text. _GUIDisable($GUI, 0, 30) should be used before, so the MsgBox is better visible and afterwards _GUIDisable($GUI). 63 | 64 | ;=============================================Progress============================================= 65 | ;_Metro_CreateProgress - Creates a simple progressbar. 66 | ;_Metro_SetProgress - Sets the progress in % of a progressbar. 67 | #EndRegion Metro Functions Overview 68 | 69 | 70 | #Region MetroGUI=========================================================================================== 71 | 72 | ; #FUNCTION# ==================================================================================================================== 73 | ; Name ..........: _Metro_CreateGUI 74 | ; Description ...: Creates a modern borderless GUI with the colors of the selected theme. 75 | ; Syntax ........: _Metro_CreateGUI($Title, $Width, $Height[, $Left = -1[, $Top = -1[, $AllowResize = False[, $ParentGUI = ""]]]]) 76 | ; Parameters ....: $Title - Title of the window 77 | ; $Width - Width 78 | ; $Height - Height 79 | ; $Left - [optional] Window pos X. Default is -1. 80 | ; $Top - [optional] Window pos Y. Default is -1. 81 | ; $AllowResize - [optional] True/False. Default is False. ;Enables resizing + drag move for the gui. 82 | ; $ParentGUI - [optional] Handle to the parent gui. Default is "". 83 | ; Return values .: Handle to the created gui 84 | ; Example .......: _Metro_CreateGUI("Example", 500, 300, -1, -1, True) 85 | ; =============================================================================================================================== 86 | Func _Metro_CreateGUI($Title, $Width, $Height, $Left = -1, $Top = -1, $AllowResize = False, $ParentGUI = "") 87 | Local $GUI_Return 88 | 89 | ;HighDPI Support 90 | If $HIGHDPI_SUPPORT Then 91 | $Width = Round($Width * $gDPI) 92 | $Height = Round($Height * $gDPI) 93 | EndIf 94 | 95 | If $AllowResize Then 96 | DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) ;Adds compatibility for Windows 7 Basic theme 97 | $GUI_Return = GUICreate($Title, $Width, $Height, $Left, $Top, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX), -1, $ParentGUI) 98 | _Metro_SetGUIOption($GUI_Return, True, True, $Width, $Height) 99 | DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", BitOR(1, 2, 4)) 100 | Else 101 | DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) ;Adds compatibility for Windows 7 Basic theme 102 | $GUI_Return = GUICreate($Title, $Width, $Height, $Left, $Top, -1, -1, $ParentGUI) 103 | _Metro_SetGUIOption($GUI_Return, False, False, $Width, $Height) 104 | DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", BitOR(1, 2, 4)) 105 | EndIf 106 | WinMove($GUI_Return, "", Default, Default, $Width, $Height) 107 | 108 | If $ParentGUI = "" Then 109 | Local $Center_GUI = _GetDesktopWorkArea($GUI_Return) 110 | If ($Left = -1) And ($Top = -1) Then 111 | WinMove($GUI_Return, "", ($Center_GUI[2] - $Width) / 2, ($Center_GUI[3] - $Height) / 2, $Width, $Height) 112 | EndIf 113 | Else 114 | If ($Left = -1) And ($Top = -1) Then 115 | Local $GUI_NewPos = _WinPos($ParentGUI, $Width, $Height) 116 | WinMove($GUI_Return, "", $GUI_NewPos[0], $GUI_NewPos[1], $Width, $Height) 117 | EndIf 118 | EndIf 119 | 120 | GUISetBkColor($GUIThemeColor) 121 | _CreateBorder($Width, $Height, $GUIBorderColor, 0, 1) 122 | 123 | Return ($GUI_Return) 124 | EndFunc ;==>_Metro_CreateGUI 125 | 126 | ; #FUNCTION# ==================================================================================================================== 127 | ; Name ..........: _Metro_SetGUIOption 128 | ; Description ...: Allows to set different options like dragmove, resize and min. resize width/height. 129 | ; Syntax ........: _Metro_SetGUIOption($mGUI[, $AllowDragMove = False[, $AllowResize = False[, $Win_MinWidth = ""[, 130 | ; $Win_MinHeight = ""]]]]) 131 | ; Parameters ....: $mGUI - a map. 132 | ; $AllowDragMove - [optional] Allow dragmove (Moving GUI by holding leftclick). Default is False. 133 | ; $AllowResize - [optional] Allow resizing of the GUI. Default is False. 134 | ; $Win_MinWidth - [optional] Min. width of the GUI in px (For resizing). Default is "". 135 | ; $Win_MinHeight - [optional] Min. height of the GUI in px(For resizing). Default is "". 136 | ; Example .......: _Metro_SetGUIOption($Form1, True, True, 400, 300) 137 | ; =============================================================================================================================== 138 | Func _Metro_SetGUIOption($mGUI, $AllowDragMove = False, $AllowResize = False, $Win_MinWidth = "", $Win_MinHeight = "") 139 | Local $iGui_Count 140 | ;Check if Gui is already registered 141 | For $iGUIs = 0 To UBound($GLOBAL_GUI_LIST) - 1 Step +1 142 | If $GLOBAL_GUI_LIST[$iGUIs][0] = $mGUI Then 143 | $iGui_Count = $iGUIs 144 | ExitLoop 145 | EndIf 146 | Next 147 | 148 | If ($iGui_Count == "") Then 149 | $iGui_Count = UBound($GLOBAL_GUI_LIST) 150 | ReDim $GLOBAL_GUI_LIST[$iGui_Count + 1][11] 151 | EndIf 152 | 153 | $GLOBAL_GUI_LIST[$iGui_Count][0] = $mGUI 154 | $GLOBAL_GUI_LIST[$iGui_Count][1] = $AllowDragMove ;Drag 155 | $GLOBAL_GUI_LIST[$iGui_Count][2] = $AllowResize ;Resize 156 | 157 | If $AllowResize Then 158 | If $Win_MinWidth = "" Then 159 | $Win_MinWidth = WinGetPos($mGUI, "") 160 | If @error Then 161 | $Win_MinWidth = 80 * $gDPI 162 | Else 163 | $Win_MinWidth = $Win_MinWidth[2] 164 | EndIf 165 | EndIf 166 | If $Win_MinHeight = "" Then 167 | $Win_MinHeight = WinGetPos($mGUI, "") 168 | If @error Then 169 | $Win_MinHeight = 50 * $gDPI 170 | Else 171 | $Win_MinHeight = $Win_MinHeight[3] 172 | EndIf 173 | EndIf 174 | $GLOBAL_GUI_LIST[$iGui_Count][3] = $Win_MinWidth ;Set Min Width of the Window 175 | $GLOBAL_GUI_LIST[$iGui_Count][4] = $Win_MinHeight ;Set Min Height of the Window 176 | GUIRegisterMsg(0x0024, "INTERNAL_WM_GETMINMAXINFO") ;Set GUI size limits 177 | GUIRegisterMsg(0x0005, "INTERNAL_WM_SIZING") ; Fix the maxmized position (otherwise we have a -7px margin on all sides due to the missing border) 178 | GUIRegisterMsg(0x0084, "INTERNAL_WM_NCHITTEST") ; For resizing and to allow doubleclick to maximize and drag on the upper GUI. 179 | EndIf 180 | 181 | If $AllowDragMove Then 182 | GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN") ; For drag/GUI moving. 183 | EndIf 184 | 185 | GUIRegisterMsg(0x0083, "INTERNAL_INTERCEPT_FRAMEDRAW") ; To Prevent window border from drawing 186 | GUIRegisterMsg(0x0086, "INTERNAL_INTERCEPT_FRAMEDRAW") ; To Prevent window border from drawing 187 | GUIRegisterMsg(0x00AE, "INTERNAL_INTERCEPT_FRAMEDRAW") ; To Prevent window border from drawing 188 | GUIRegisterMsg(0x00AF, "INTERNAL_INTERCEPT_FRAMEDRAW") ; To Prevent window border from drawing 189 | GUIRegisterMsg(0x0085, "INTERNAL_INTERCEPT_FRAMEDRAW") ; To Prevent window border from drawing 190 | EndFunc ;==>_Metro_SetGUIOption 191 | 192 | 193 | ; #FUNCTION# ==================================================================================================================== 194 | ; Name ..........: _Metro_GUIDelete 195 | ; Description ...: Destroys all created metro buttons,checkboxes,radios etc., deletes the GUI and reduces memory usage. 196 | ; Syntax ........: _Metro_GUIDelete($GUI) 197 | ; Parameters ....: $GUI - Handle to the gui to be deleted 198 | ; =============================================================================================================================== 199 | Func _Metro_GUIDelete($GUI) 200 | For $i = 0 To (UBound($GLOBAL_HOVER_REG) - 1) Step +1 201 | If $GLOBAL_HOVER_REG[$i][15] = $GUI Then 202 | Switch ($GLOBAL_HOVER_REG[$i][3]) 203 | Case "5", "7" 204 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][5]) 205 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][6]) 206 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][7]) 207 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][8]) 208 | Case "6" 209 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][5]) 210 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][6]) 211 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][7]) 212 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][8]) 213 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][9]) 214 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][10]) 215 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][11]) 216 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][12]) 217 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][13]) 218 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][14]) 219 | Case Else 220 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][5]) 221 | _WinAPI_DeleteObject($GLOBAL_HOVER_REG[$i][6]) 222 | EndSwitch 223 | EndIf 224 | Next 225 | _Internal_GUIRemoveHover($GUI) 226 | GUIDelete($GUI) 227 | 228 | ;Remove from Global GUI List 229 | Local $CLEANED_GUI_LIST[0] 230 | For $i_HR = 0 To UBound($GLOBAL_GUI_LIST) - 1 Step +1 231 | If Not ($GLOBAL_GUI_LIST[$i_HR][0] = $GUI) Then 232 | ReDim $CLEANED_GUI_LIST[UBound($CLEANED_GUI_LIST) + 1][11] 233 | For $i_Hx = 0 To 10 Step +1 234 | $CLEANED_GUI_LIST[UBound($CLEANED_GUI_LIST) - 1][$i_Hx] = $GLOBAL_GUI_LIST[$i_HR][$i_Hx] 235 | Next 236 | EndIf 237 | Next 238 | $GLOBAL_GUI_LIST = $CLEANED_GUI_LIST 239 | 240 | _ReduceMemory() 241 | EndFunc ;==>_Metro_GUIDelete 242 | 243 | ; #FUNCTION# ==================================================================================================================== 244 | ; Name ..........: _Metro_AddControlButtons 245 | ; Description ...: Creates the selected control buttons for a metro style gui. 246 | ; Syntax ........: _Metro_AddControlButtons([$CloseBtn = True[, $MaximizeBtn = True[, $MinimizeBtn = True[, $FullScreenBtn = True[, 247 | ; $MenuBtn = False]]]]]) 248 | ; Parameters ....: $CloseBtn - [optional] True/False. Default is True. ;Adds a close button 249 | ; $MaximizeBtn - [optional] True/False. Default is True. ;Adds a maximize/restore button 250 | ; $MinimizeBtn - [optional] True/False. Default is True. ;Adds a minimize button 251 | ; $FullScreenBtn - [optional] True/False. Default is True. ;Adds a fullscreen toggle button 252 | ; $MenuBtn - [optional] True/False. Default is False.;Adds a Menu Button that can be used with _Metro_MenuStart 253 | 254 | ; $GUI_BG_Color - [optional] Custom color for the background of the buttons. Example: "0x000000", Default is $GUIThemeColor of the selected theme 255 | ; $GUI_Font_Color - [optional] Custom color for the text color of the buttons. Example: "0xFFFFFF", Default is $FontThemeColor of the selected theme 256 | ; Return values .: Array with size 7 that contains all handles of the created control buttons. Note: Array size is always the same and so is the order of the handles even if not all buttons are created. See below: 257 | ; Array[0] = Close button 258 | ; Array[1] = Maximize button 259 | ; Array[2] = Restore button 260 | ; Array[3] = Minimize button 261 | ; Array[4] = Fullscreen ON button 262 | ; Array[5] = Fullscreen OFF button 263 | ; Array[6] = Menu button 264 | ; Example .......: _Metro_AddControlButtons(True, True, True, True, True) 265 | ; =============================================================================================================================== 266 | Func _Metro_AddControlButtons($CloseBtn = True, $MaximizeBtn = True, $MinimizeBtn = True, $FullScreenBtn = False, $MenuBtn = False, $GUI_BG_Color = $GUIThemeColor, $GUI_Font_Color = $FontThemeColor) 267 | Local $ButtonsToCreate_Array[5] 268 | $ButtonsToCreate_Array[0] = $CloseBtn 269 | $ButtonsToCreate_Array[1] = $MaximizeBtn 270 | $ButtonsToCreate_Array[2] = $MinimizeBtn 271 | $ButtonsToCreate_Array[3] = $FullScreenBtn 272 | $ButtonsToCreate_Array[4] = $MenuBtn 273 | 274 | Return _Internal_CreateControlButtons($ButtonsToCreate_Array, $GUI_BG_Color, $GUI_Font_Color, False) 275 | EndFunc ;==>_Metro_AddControlButtons 276 | 277 | ; #FUNCTION# ==================================================================================================================== 278 | ; Name ..........: _Metro_EnableHighDPIScaling 279 | ; Description ...: Enables high DPI support: Detects the users DPI settings and resizes GUI and all controls to look perfectly sharp 280 | ; Syntax ........: _Metro_EnableHighDPIScaling() 281 | ; =============================================================================================================================== 282 | Func _Metro_EnableHighDPIScaling() 283 | $HIGHDPI_SUPPORT = True 284 | EndFunc ;==>_Metro_EnableHighDPIScaling 285 | 286 | 287 | ; #FUNCTION# ==================================================================================================================== 288 | ; Name ..........: _Metro_FullscreenToggle 289 | ; Description ...: Toggles between fullscreen and normal window. NOTE: $AllowResize has to be set True when creating a gui and this also requires the creation of a fullscreen control button. 290 | ; Syntax ........: _Metro_FullscreenToggle($mGUI, $Control_Buttons_Array) 291 | ; Parameters ....: $mGUI - Handle to the GUI. 292 | ; $Control_Buttons_Array - Array containing the control button handles as returned from _Metro_AddControlButtons. 293 | ; Note2 .........: Fullscreen toggle only works with ONE gui at the same time. You can't create 2 Guis which are toggled to fullscreen at the same time. They will interfere with each other. 294 | ; =============================================================================================================================== 295 | Func _Metro_FullscreenToggle($mGUI, $Control_Buttons_Array) 296 | 297 | Local $iGui_Count 298 | For $iGUIs = 0 To UBound($GLOBAL_GUI_LIST) - 1 Step +1 299 | If $GLOBAL_GUI_LIST[$iGUIs][0] = $mGUI Then 300 | $iGui_Count = $iGUIs 301 | ExitLoop 302 | EndIf 303 | Next 304 | If ($iGui_Count == "") Then 305 | ConsoleWrite("Fullscreen-Toggle failed: GUI not registered. Not created with _Metro_CreateGUI ?" & @CRLF) 306 | Return SetError(1) ; 307 | EndIf 308 | If Not $GLOBAL_GUI_LIST[$iGui_Count][2] Then 309 | ConsoleWrite("Fullscreen-Toggle failed: GUI is not registered for resizing. Please use _Metro_SetGUIOption to enable resizing." & @CRLF) 310 | Return SetError(2) ; 311 | EndIf 312 | 313 | Local $mWin_State = WinGetState($mGUI) 314 | Local $tRET = _WinAPI_GetWindowPlacement($mGUI) 315 | Local $FullScreenPOS = _GetDesktopWorkArea($mGUI, True) 316 | Local $FullScreenPOSEx = _GetDesktopWorkArea($mGUI) 317 | Local $CurrentPos = WinGetPos($mGUI) 318 | If (BitAND($mWin_State, 32) = 32) Then ; If maximized then 319 | WinMove($mGUI, "", $FullScreenPOS[0], $FullScreenPOS[1], $FullScreenPOS[2], $FullScreenPOS[3]) 320 | $CurrentPos[0] = DllStructGetData($tRET, "rcNormalPosition", 1) 321 | $CurrentPos[1] = DllStructGetData($tRET, "rcNormalPosition", 2) 322 | $CurrentPos[2] = DllStructGetData($tRET, "rcNormalPosition", 3) 323 | $CurrentPos[3] = DllStructGetData($tRET, "rcNormalPosition", 4) 324 | EndIf 325 | 326 | If (($CurrentPos[0] = $FullScreenPOS[0]) And ($CurrentPos[1] = $FullScreenPOS[1]) And ($CurrentPos[2] = $FullScreenPOS[2]) And ($CurrentPos[3] = $FullScreenPOS[3])) Then 327 | GUIRegisterMsg(0x0024, "INTERNAL_WM_GETMINMAXINFO") 328 | If (BitAND($GLOBAL_GUI_LIST[$iGui_Count][9], 32) = 32) Then ; If maximized then 329 | GUISetState(@SW_MAXIMIZE) 330 | $tRET = $GLOBAL_GUI_LIST[$iGui_Count][10] 331 | DllStructSetData($tRET, "rcNormalPosition", $GLOBAL_GUI_LIST[$iGui_Count][5], 1) ; left 332 | DllStructSetData($tRET, "rcNormalPosition", $GLOBAL_GUI_LIST[$iGui_Count][6], 2) ; top 333 | DllStructSetData($tRET, "rcNormalPosition", $GLOBAL_GUI_LIST[$iGui_Count][7], 3) ; right 334 | DllStructSetData($tRET, "rcNormalPosition", $GLOBAL_GUI_LIST[$iGui_Count][8], 4) ; bottom 335 | _WinAPI_SetWindowPlacement($mGUI, $tRET) 336 | Else 337 | WinMove($mGUI, "", $GLOBAL_GUI_LIST[$iGui_Count][5], $GLOBAL_GUI_LIST[$iGui_Count][6], $GLOBAL_GUI_LIST[$iGui_Count][7], $GLOBAL_GUI_LIST[$iGui_Count][8]) 338 | EndIf 339 | 340 | If Not ($Control_Buttons_Array[1] = "") Then 341 | GUICtrlSetState($Control_Buttons_Array[2], 16 + 64) 342 | GUICtrlSetState($Control_Buttons_Array[1], 16 + 64) 343 | EndIf 344 | GUICtrlSetState($Control_Buttons_Array[5], 32) 345 | GUICtrlSetState($Control_Buttons_Array[4], 16) 346 | GUIRegisterMsg(0x0084, "INTERNAL_WM_NCHITTEST") 347 | GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN") 348 | GUIRegisterMsg(0x0005, "INTERNAL_WM_SIZING") 349 | Else 350 | GUIRegisterMsg(0x0084, "") 351 | GUIRegisterMsg(0x0201, "") 352 | If (BitAND($mWin_State, 32) = 32) Then ; If maximized then 353 | DllStructSetData($tRET, "rcNormalPosition", $FullScreenPOS[0], 1) ; left 354 | DllStructSetData($tRET, "rcNormalPosition", $FullScreenPOS[1], 2) ; top 355 | DllStructSetData($tRET, "rcNormalPosition", $FullScreenPOS[0] + $FullScreenPOS[2], 3) ; right 356 | DllStructSetData($tRET, "rcNormalPosition", $FullScreenPOS[1] + $FullScreenPOS[3], 4) ; bottom 357 | _WinAPI_SetWindowPlacement($mGUI, $tRET) 358 | Sleep(50) 359 | $GLOBAL_GUI_LIST[$iGui_Count][10] = $tRET 360 | GUISetState(@SW_RESTORE) 361 | Else 362 | Sleep(50) 363 | WinMove($mGUI, "", $FullScreenPOS[0], $FullScreenPOS[1], $FullScreenPOS[2], $FullScreenPOS[3]) 364 | EndIf 365 | GUICtrlSetState($Control_Buttons_Array[4], 32) 366 | If Not ($Control_Buttons_Array[1] = "") Then 367 | GUICtrlSetState($Control_Buttons_Array[1], 32 + 128) 368 | GUICtrlSetState($Control_Buttons_Array[2], 32 + 128) 369 | EndIf 370 | GUICtrlSetState($Control_Buttons_Array[5], 16) 371 | $GLOBAL_GUI_LIST[$iGui_Count][5] = $CurrentPos[0] 372 | $GLOBAL_GUI_LIST[$iGui_Count][6] = $CurrentPos[1] 373 | $GLOBAL_GUI_LIST[$iGui_Count][7] = $CurrentPos[2] 374 | $GLOBAL_GUI_LIST[$iGui_Count][8] = $CurrentPos[3] 375 | $GLOBAL_GUI_LIST[$iGui_Count][9] = $mWin_State 376 | EndIf 377 | EndFunc ;==>_Metro_FullscreenToggle 378 | 379 | 380 | ; #FUNCTION# ==================================================================================================================== 381 | ; Name ..........: _Metro_AddControlButton_Back 382 | ; Description ...: Creates a back button on the left+top side of the gui. 383 | ; Syntax ........: _Metro_AddControlButton_Back([, $GUI_BG_Color = $GUIThemeColor[, $GUI_Font_Color = $FontThemeColor]]) 384 | ; Parameters ....: $GUI_BG_Color - [optional] Background color. Default is $GUIThemeColor. 385 | ; $GUI_Font_Color - [optional] Text color. Default is $FontThemeColor. 386 | ; Return values .: Handle to the button 387 | ; Remarks .......: If a menu control button is visible, then it has to be hidden first before showing this button, as they are on the same position. 388 | ; Example .......: _Metro_AddControlButton_Back() 389 | ; =============================================================================================================================== 390 | Func _Metro_AddControlButton_Back($GUI_BG_Color = $GUIThemeColor, $GUI_Font_Color = $FontThemeColor) 391 | Local $cbDPI = _HighDPICheck() 392 | 393 | ;Set Colors 394 | $GUI_Font_Color = StringReplace($GUI_Font_Color, "0x", "0xFF") 395 | $GUI_BG_Color = StringReplace($GUI_BG_Color, "0x", "0xFF") 396 | If StringInStr($GUI_Theme_Name, "Light") Then 397 | Local $Hover_BK_Color = StringReplace(_AlterBrightness($GUI_BG_Color, -20), "0x", "0xFF") 398 | Else 399 | Local $Hover_BK_Color = StringReplace(_AlterBrightness($GUI_BG_Color, +20), "0x", "0xFF") 400 | EndIf 401 | 402 | Local $FrameSize = Round(1 * $cbDPI) 403 | Local $hPen = _GDIPlus_PenCreate($GUI_Font_Color, Round(1 * $cbDPI)) 404 | If StringInStr($GUI_Theme_Name, "Light") Then 405 | Local $hPen1 = _GDIPlus_PenCreate(StringReplace(_AlterBrightness($GUI_Font_Color, +60), "0x", "0xFF"), Round(1 * $cbDPI)) ;inactive 406 | Else 407 | Local $hPen1 = _GDIPlus_PenCreate(StringReplace(_AlterBrightness($GUI_Font_Color, -80), "0x", "0xFF"), Round(1 * $cbDPI)) ;inactive 408 | EndIf 409 | 410 | ;Create Button Array 411 | Local $Control_Button_Array[16] 412 | 413 | ;Calc Sizes 414 | Local $CBw = Number(45 * $cbDPI, 1) 415 | Local $CBh = Number(29 * $cbDPI, 1) 416 | Local $cMarginR = Number(2 * $cbDPI, 1) 417 | 418 | ;Create GuiPics and set hover states 419 | 420 | $Control_Button_Array[1] = False ; Hover state 421 | $Control_Button_Array[2] = False ; Set inactive state 422 | $Control_Button_Array[3] = "0" ; Type 423 | $Control_Button_Array[15] = GetCurrentGUI() 424 | 425 | ;Create Graphics 426 | Local $Control_Button_Graphic1 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4) 427 | Local $Control_Button_Graphic2 = _GDIPlusGraphic_Create($CBw, $CBh, $Hover_BK_Color, 0, 4) 428 | Local $Control_Button_Graphic3 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4) 429 | 430 | ;Create Back Button 431 | 432 | ;Calc size+pos 433 | Local $Cutpoint = Round(($FrameSize * 0.70) / 2) 434 | Local $mpX = $CBw / 2.95, $mpY = $CBh / 2.1 435 | Local $apos1 = cAngle($mpX, $mpY + $Cutpoint, 135, 12 * $cbDPI) 436 | Local $apos2 = cAngle($mpX, $mpY - $Cutpoint, 45, 12 * $cbDPI) 437 | 438 | ;Add arrow 439 | _GDIPlus_GraphicsDrawLine($Control_Button_Graphic1[0], $mpX, $mpY + $Cutpoint, $apos1[0], $apos1[1], $hPen) ;r 440 | _GDIPlus_GraphicsDrawLine($Control_Button_Graphic1[0], $mpX, $mpY - $Cutpoint, $apos2[0], $apos2[1], $hPen) ;l 441 | 442 | _GDIPlus_GraphicsDrawLine($Control_Button_Graphic2[0], $mpX, $mpY + $Cutpoint, $apos1[0], $apos1[1], $hPen) ;r 443 | _GDIPlus_GraphicsDrawLine($Control_Button_Graphic2[0], $mpX, $mpY - $Cutpoint, $apos2[0], $apos2[1], $hPen) ;l 444 | 445 | _GDIPlus_GraphicsDrawLine($Control_Button_Graphic3[0], $mpX, $mpY + $Cutpoint, $apos1[0], $apos1[1], $hPen1) ;r 446 | _GDIPlus_GraphicsDrawLine($Control_Button_Graphic3[0], $mpX, $mpY - $Cutpoint, $apos2[0], $apos2[1], $hPen1) ;l 447 | ;Release resources 448 | _GDIPlus_PenDispose($hPen) 449 | _GDIPlus_PenDispose($hPen1) 450 | 451 | ;Create bitmap handles and set graphic 452 | $Control_Button_Array[0] = GUICtrlCreatePic("", $cMarginR, $cMarginR, $CBw, $CBh) 453 | $Control_Button_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Control_Button_Array[0], $Control_Button_Graphic1) 454 | $Control_Button_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Control_Button_Array[0], $Control_Button_Graphic2, False) 455 | $Control_Button_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Control_Button_Array[0], $Control_Button_Graphic3, False) 456 | 457 | ;Set GUI Resizing 458 | GUICtrlSetResizing($Control_Button_Array[0], 768 + 32 + 2) 459 | 460 | _Internal_AddHoverItem($Control_Button_Array) 461 | Return $Control_Button_Array[0] 462 | EndFunc ;==>_Metro_AddControlButton_Back 463 | 464 | 465 | ; #FUNCTION# ==================================================================================================================== 466 | ; Name ..........: _Metro_MenuStart 467 | ; Description ...: Shows/creates a menu window that slides in from the right side of the gui. (Similar to Android menus or Windows 10 calculator app) 468 | ; Syntax ........: _Metro_MenuStart($mGUI, $Metro_MenuBtn, $mWidth, $ButtonsArray) 469 | ; Parameters ....: $mGUI - Handle to the gui. 470 | ; $Metro_MenuBtn - Handle to the menu button that is returned by _Metro_AddControlButtons. (this would be $Array[6] returned by _Metro_AddControlButtons function) 471 | ; $mWidth - Width of the Menu 472 | ; $ButtonsArray - An array containing button names to be created. 473 | ; Example: Local $MenuButtonsArray[4] = ["Settings","About","Contact","Exit"] ; id 0 = Settings, 1 = About, 2 = Contact, 3 = Exit 474 | ; $bFont - [optional] Custom font for the buttons. Default "Arial" 475 | ; $bFontSize - [optional] Custom font size for the buttons. Default 9 476 | ; $bFontStyle - [optional] Custom font style for the buttons. Default 1 477 | ; Return values .: index of the clicked button from $ButtonsArray or @error and value "none" if nothing is clicked. Example: Users selects "Exit" button in the menu, so this function would return "3". 478 | ; =============================================================================================================================== 479 | Func _Metro_MenuStart($mGUI, $Metro_MenuBtn, $mWidth, $ButtonsArray, $bFont = "Arial", $bFontSize = 9, $bFontStyle = 1) 480 | 481 | GUICtrlSetState($Metro_MenuBtn, 128) 482 | 483 | Local $iButtonsArray[UBound($ButtonsArray)] 484 | Local $cbDPI = _HighDPICheck() 485 | 486 | Local $blockclose = True 487 | Local $mPos = WinGetPos($mGUI) 488 | Local $cMarginR = Number(2 * $cbDPI, 1) 489 | Local $CBh = Number(29 * $cbDPI, 1) 490 | Local $mGuiHeight = $mPos[3] - ($cMarginR * 2) - $CBh 491 | Local $mGuiWidth = $mWidth * $cbDPI 492 | Local $mGuiX = $mPos[0] + $cMarginR, $mGuiY = $mPos[1] + $cMarginR + $CBh 493 | Local $AnimStep = $mGuiWidth / 10, $mGuiWidthAnim = $AnimStep 494 | Local $MenuForm = GUICreate("", $mGuiWidthAnim, $mGuiHeight, $mGuiX, $mGuiY, $WS_POPUP, $WS_EX_MDICHILD, $mGUI) 495 | Local $ButtonStep = (30 * $cbDPI) 496 | If StringInStr($GUI_Theme_Name, "Light") Then 497 | GUISetBkColor(_AlterBrightness($GUIThemeColor, -10), $MenuForm) 498 | Else 499 | GUISetBkColor(_AlterBrightness($GUIThemeColor, +10), $MenuForm) 500 | EndIf 501 | For $iB = 0 To UBound($ButtonsArray) - 1 Step +1 502 | $iButtonsArray[$iB] = _Internal_CreateMButton($ButtonsArray[$iB], 0, $ButtonStep * $iB + ($iB * 2), $mGuiWidth - $cMarginR, 30 * $cbDPI, $GUIThemeColor, $FontThemeColor, $bFont, $bFontSize, $bFontStyle) 503 | Next 504 | 505 | GUISetState(@SW_SHOW, $MenuForm) 506 | 507 | For $i = 0 To 8 Step +1 508 | $mGuiWidthAnim = $mGuiWidthAnim + $AnimStep 509 | WinMove($MenuForm, "", $mGuiX, $mGuiY, $mGuiWidthAnim, $mGuiHeight) 510 | 511 | Sleep(1) 512 | Next 513 | 514 | While 1 515 | _Metro_HoverCheck_Loop($MenuForm, $mGUI) 516 | _Metro_HoverCheck_Loop($mGUI, $MenuForm) 517 | If Not $blockclose Then 518 | If Not WinActive($MenuForm) Then 519 | $mPos = WinGetPos($mGUI) 520 | $mGuiX = $mPos[0] + $cMarginR 521 | $mGuiY = $mPos[1] + $cMarginR + $CBh 522 | For $i = 0 To 8 Step +1 523 | $mGuiWidthAnim = $mGuiWidthAnim - $AnimStep 524 | WinMove($MenuForm, "", $mGuiX, $mGuiY, $mGuiWidthAnim, $mGuiHeight) 525 | Sleep(1) 526 | Next 527 | GUIDelete($MenuForm) 528 | GUICtrlSetState($Metro_MenuBtn, 64) 529 | Return SetError(1, 0, "none") 530 | EndIf 531 | Else 532 | $blockclose = False 533 | EndIf 534 | Local $imsg = GUIGetMsg() 535 | For $iB = 0 To UBound($iButtonsArray) - 1 Step +1 536 | If $imsg = $iButtonsArray[$iB] Then 537 | $mPos = WinGetPos($mGUI) 538 | $mGuiX = $mPos[0] + $cMarginR 539 | $mGuiY = $mPos[1] + $cMarginR + $CBh 540 | For $if = 0 To 8 Step +2 541 | $mGuiWidthAnim = $mGuiWidthAnim - $AnimStep 542 | WinMove($MenuForm, "", $mGuiX, $mGuiY, $mGuiWidthAnim, $mGuiHeight) 543 | Sleep(1) 544 | Next 545 | GUIDelete($MenuForm) 546 | GUICtrlSetState($Metro_MenuBtn, 64) 547 | Return $iB 548 | EndIf 549 | Next 550 | WEnd 551 | 552 | EndFunc ;==>_Metro_MenuStart 553 | 554 | 555 | Func _Internal_CreateMButton($Text, $Left, $Top, $Width, $Height, $BG_Color = $GUIThemeColor, $Font_Color = $FontThemeColor, $Font = "Arial", $Fontsize = 9, $FontStyle = 1, $FrameColor = "0xFFFFFF") 556 | Local $Button_Array[16] 557 | 558 | Local $btnDPI = 1 559 | If $HIGHDPI_SUPPORT Then 560 | $btnDPI = $gDPI 561 | Else 562 | $Fontsize = ($Fontsize / $Font_DPI_Ratio) 563 | EndIf 564 | 565 | 566 | $Button_Array[1] = False ; Set hover OFF 567 | $Button_Array[3] = "2" ; Type 568 | $Button_Array[15] = GetCurrentGUI() 569 | 570 | ;Set Colors 571 | $BG_Color = StringReplace($BG_Color, "0x", "0xFF") 572 | $Font_Color = StringReplace($Font_Color, "0x", "0xFF") 573 | $FrameColor = StringReplace($FrameColor, "0x", "0xFF") 574 | Local $Brush_BTN_FontColor = _GDIPlus_BrushCreateSolid($Font_Color) 575 | 576 | If StringInStr($GUI_Theme_Name, "Light") Then 577 | Local $BG_ColorD = StringReplace(_AlterBrightness($GUIThemeColor, -12), "0x", "0xFF") 578 | $BG_Color = StringReplace(_AlterBrightness($GUIThemeColor, -25), "0x", "0xFF") 579 | Else 580 | Local $BG_ColorD = StringReplace(_AlterBrightness($GUIThemeColor, +12), "0x", "0xFF") 581 | $BG_Color = StringReplace(_AlterBrightness($GUIThemeColor, +25), "0x", "0xFF") 582 | EndIf 583 | 584 | ;Create Button graphics 585 | Local $Button_Graphic1 = _GDIPlusGraphic_Create($Width, $Height, $BG_ColorD, 0, 5) ;Default 586 | Local $Button_Graphic2 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5) ;Hover 587 | 588 | ;Create font, Set font options 589 | Local $hFormat = _GDIPlus_StringFormatCreate(), $hFamily = _GDIPlus_FontFamilyCreate($Font), $hFont = _GDIPlus_FontCreate($hFamily, $Fontsize, $FontStyle) 590 | Local $tLayout = _GDIPlus_RectFCreate(0, 0, $Width, $Height) 591 | _GDIPlus_StringFormatSetAlign($hFormat, 1) 592 | _GDIPlus_StringFormatSetLineAlign($hFormat, 1) 593 | 594 | ;Draw button text 595 | _GDIPlus_GraphicsDrawStringEx($Button_Graphic1[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 596 | _GDIPlus_GraphicsDrawStringEx($Button_Graphic2[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 597 | 598 | ;Release created objects 599 | _GDIPlus_FontDispose($hFont) 600 | _GDIPlus_FontFamilyDispose($hFamily) 601 | _GDIPlus_StringFormatDispose($hFormat) 602 | _GDIPlus_BrushDispose($Brush_BTN_FontColor) 603 | 604 | ;Set graphic and return Bitmap handle 605 | $Button_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height) 606 | $Button_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_Array[0], $Button_Graphic1) 607 | $Button_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_Array[0], $Button_Graphic2, False) 608 | 609 | ;For GUI Resizing 610 | GUICtrlSetResizing($Button_Array[0], 802) 611 | 612 | _Internal_AddHoverItem($Button_Array) 613 | Return $Button_Array[0] 614 | EndFunc ;==>_Internal_CreateMButton 615 | 616 | 617 | 618 | Func _Internal_CreateControlButtons($ButtonsToCreate_Array, $GUI_BG_Color = $GUIThemeColor, $GUI_Font_Color = "0xFFFFFF", $CloseButtonOnStyle = False) 619 | ;HighDPI Support 620 | Local $cbDPI = _HighDPICheck() 621 | 622 | ;Set Colors 623 | ;========================================================================= 624 | Local $FrameSize = Round(1 * $cbDPI), $Hover_BK_Color 625 | $GUI_Font_Color = StringReplace($GUI_Font_Color, "0x", "0xFF") 626 | $GUI_BG_Color = StringReplace($GUI_BG_Color, "0x", "0xFF") 627 | If StringInStr($GUI_Theme_Name, "Light") Then 628 | $Hover_BK_Color = StringReplace(_AlterBrightness($GUI_BG_Color, -20), "0x", "0xFF") 629 | Else 630 | $Hover_BK_Color = StringReplace(_AlterBrightness($GUI_BG_Color, +20), "0x", "0xFF") 631 | EndIf 632 | Local $hPen = _GDIPlus_PenCreate($GUI_Font_Color, Round(1 * $cbDPI)) 633 | Local $hPen2 = _GDIPlus_PenCreate($GUI_Font_Color, Round(1 * $cbDPI)) 634 | Local $hPen3 = _GDIPlus_PenCreate("0xFFFFFFFF", Round(1 * $cbDPI)) 635 | If StringInStr($GUI_Theme_Name, "Light") Then 636 | Local $hPen4 = _GDIPlus_PenCreate(StringReplace(_AlterBrightness($GUI_Font_Color, +60), "0x", "0xFF"), $FrameSize) ;inactive 637 | Else 638 | Local $hPen4 = _GDIPlus_PenCreate(StringReplace(_AlterBrightness($GUI_Font_Color, -80), "0x", "0xFF"), $FrameSize) ;inactive 639 | EndIf 640 | Local $hPen5 = _GDIPlus_PenCreate(StringReplace(_AlterBrightness("0xFFFFFF", -80), "0x", "0xFF"), $FrameSize) ;inactive style 2 641 | Local $hBrush = _GDIPlus_BrushCreateSolid($GUI_BG_Color), $hBrush2 = _GDIPlus_BrushCreateSolid($Hover_BK_Color) 642 | ;========================================================================= 643 | 644 | ;Create Button Arrays 645 | Local $Control_Buttons[16] 646 | Local $Button_Close_Array[16] 647 | Local $Button_Minimize_Array[16] 648 | Local $Button_Maximize_Array[16] 649 | Local $Button_Restore_Array[16] 650 | Local $Button_Menu_Array[16] 651 | Local $Button_FullScreen_Array[16] 652 | Local $Button_FSRestore_Array[16] 653 | 654 | ;Calc Sizes 655 | Local $CBw = Number(45 * $cbDPI, 1) 656 | Local $CBh = Number(29 * $cbDPI, 1) 657 | Local $cMarginR = Number(2 * $cbDPI, 1) 658 | Local $CurrentGUI = GetCurrentGUI() 659 | 660 | Local $Win_POS = WinGetPos($CurrentGUI) 661 | Local $PosCount = 0 662 | 663 | ;Create GuiPics and set hover states 664 | If $ButtonsToCreate_Array[0] Then 665 | $PosCount = $PosCount + 1 666 | $Button_Close_Array[0] = GUICtrlCreatePic("", $Win_POS[2] - $cMarginR - ($CBw * $PosCount), $cMarginR, $CBw, $CBh) 667 | GUICtrlSetState(-1, 2048) 668 | $Button_Close_Array[1] = False ; Hover state 669 | $Button_Close_Array[2] = False ; Inactive Color state 670 | $Button_Close_Array[3] = "0" ; Type 671 | $Button_Close_Array[15] = $CurrentGUI 672 | EndIf 673 | 674 | If $ButtonsToCreate_Array[1] Then 675 | $PosCount = $PosCount + 1 676 | $Button_Maximize_Array[0] = GUICtrlCreatePic("", $Win_POS[2] - $cMarginR - ($CBw * $PosCount), $cMarginR, $CBw, $CBh) 677 | GUICtrlSetState(-1, 2048) 678 | $Button_Maximize_Array[1] = False 679 | $Button_Maximize_Array[2] = False ; Inactive Color state 680 | $Button_Maximize_Array[3] = "3" 681 | $Button_Maximize_Array[15] = $CurrentGUI 682 | 683 | $Button_Restore_Array[0] = GUICtrlCreatePic("", $Win_POS[2] - $cMarginR - ($CBw * $PosCount), $cMarginR, $CBw, $CBh) 684 | GUICtrlSetState(-1, 2048) 685 | $Button_Restore_Array[1] = False 686 | $Button_Restore_Array[2] = False ;Inactive Color state 687 | $Button_Restore_Array[3] = "4" 688 | $Button_Restore_Array[15] = $CurrentGUI 689 | If $ButtonsToCreate_Array[3] Then 690 | $Button_FSRestore_Array[0] = GUICtrlCreatePic("", $Win_POS[2] - $cMarginR - ($CBw * $PosCount), $cMarginR, $CBw, $CBh) 691 | GUICtrlSetState(-1, 2048) 692 | $Button_FSRestore_Array[1] = False 693 | $Button_FSRestore_Array[2] = False ; Inactive Color state 694 | $Button_FSRestore_Array[3] = "0" 695 | $Button_FSRestore_Array[15] = $CurrentGUI 696 | EndIf 697 | EndIf 698 | 699 | If $ButtonsToCreate_Array[2] Then 700 | $PosCount = $PosCount + 1 701 | $Button_Minimize_Array[0] = GUICtrlCreatePic("", $Win_POS[2] - $cMarginR - ($CBw * $PosCount), $cMarginR, $CBw, $CBh) 702 | GUICtrlSetState(-1, 2048) 703 | $Button_Minimize_Array[1] = False 704 | $Button_Minimize_Array[2] = False ; Inactive Color state 705 | $Button_Minimize_Array[3] = "0" 706 | $Button_Minimize_Array[15] = $CurrentGUI 707 | EndIf 708 | 709 | If $ButtonsToCreate_Array[3] Then 710 | $PosCount = $PosCount + 1 711 | $Button_FullScreen_Array[0] = GUICtrlCreatePic("", $Win_POS[2] - $cMarginR - ($CBw * $PosCount), $cMarginR, $CBw, $CBh) 712 | GUICtrlSetState(-1, 2048) 713 | $Button_FullScreen_Array[1] = False 714 | $Button_FullScreen_Array[2] = False ; Inactive Color state 715 | $Button_FullScreen_Array[3] = "0" 716 | $Button_FullScreen_Array[15] = $CurrentGUI 717 | 718 | If Not ($Button_FSRestore_Array[15] = $CurrentGUI) Then 719 | $Button_FSRestore_Array[0] = GUICtrlCreatePic("", $Win_POS[2] - $cMarginR - ($CBw * $PosCount), $cMarginR, $CBw, $CBh) 720 | GUICtrlSetState(-1, 2048) 721 | $Button_FSRestore_Array[1] = False 722 | $Button_FSRestore_Array[2] = False ; Inactive Color state 723 | $Button_FSRestore_Array[3] = "0" 724 | $Button_FSRestore_Array[15] = $CurrentGUI 725 | EndIf 726 | EndIf 727 | 728 | If $ButtonsToCreate_Array[4] Then 729 | $Button_Menu_Array[0] = GUICtrlCreatePic("", $cMarginR, $cMarginR, $CBw, $CBh) 730 | GUICtrlSetState(-1, 2048) 731 | $Button_Menu_Array[1] = False 732 | $Button_Menu_Array[2] = False ; Inactive Color state 733 | $Button_Menu_Array[3] = "8" 734 | $Button_Menu_Array[15] = $CurrentGUI 735 | EndIf 736 | 737 | ;Create Graphics 738 | If $ButtonsToCreate_Array[0] Then 739 | Local $Button_Close_Graphic1 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 4, 4), $Button_Close_Graphic2 = _GDIPlusGraphic_Create($CBw, $CBh, "0xFFE81123", 4, 4), $Button_Close_Graphic3 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 4, 4) 740 | EndIf 741 | If $ButtonsToCreate_Array[1] Then 742 | Local $Button_Maximize_Graphic1 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4), $Button_Maximize_Graphic2 = _GDIPlusGraphic_Create($CBw, $CBh, $Hover_BK_Color, 0, 4), $Button_Maximize_Graphic3 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4) 743 | Local $Button_Restore_Graphic1 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4), $Button_Restore_Graphic2 = _GDIPlusGraphic_Create($CBw, $CBh, $Hover_BK_Color, 0, 4), $Button_Restore_Graphic3 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4) 744 | EndIf 745 | If $ButtonsToCreate_Array[2] Then 746 | Local $Button_Minimize_Graphic1 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4), $Button_Minimize_Graphic2 = _GDIPlusGraphic_Create($CBw, $CBh, $Hover_BK_Color, 0, 4), $Button_Minimize_Graphic3 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4) 747 | EndIf 748 | If $ButtonsToCreate_Array[3] Then 749 | Local $Button_FullScreen_Graphic1 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4), $Button_FullScreen_Graphic2 = _GDIPlusGraphic_Create($CBw, $CBh, $Hover_BK_Color, 0, 4), $Button_FullScreen_Graphic3 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4) 750 | Local $Button_FSRestore_Graphic1 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4), $Button_FSRestore_Graphic2 = _GDIPlusGraphic_Create($CBw, $CBh, $Hover_BK_Color, 0, 4), $Button_FSRestore_Graphic3 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4) 751 | EndIf 752 | If $ButtonsToCreate_Array[4] Then 753 | Local $Button_Menu_Graphic1 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4), $Button_Menu_Graphic2 = _GDIPlusGraphic_Create($CBw, $CBh, $Hover_BK_Color, 0, 4), $Button_Menu_Graphic3 = _GDIPlusGraphic_Create($CBw, $CBh, $GUI_BG_Color, 0, 4) 754 | EndIf 755 | 756 | ;Set close button BG color style 757 | If $CloseButtonOnStyle Then 758 | _GDIPlus_GraphicsClear($Button_Close_Graphic1[0], "0xFFB52231") ; 759 | _GDIPlus_GraphicsClear($Button_Close_Graphic3[0], "0xFFB52231") ; 760 | EndIf 761 | 762 | ;Create Close Button========================================================================================================== 763 | If $ButtonsToCreate_Array[0] Then 764 | If $CloseButtonOnStyle Then 765 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic1[0], 17 * $cbDPI, 9 * $cbDPI, 27 * $cbDPI, 19 * $cbDPI, $hPen3) 766 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic1[0], 27 * $cbDPI, 9 * $cbDPI, 17 * $cbDPI, 19 * $cbDPI, $hPen3) 767 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic3[0], 17 * $cbDPI, 9 * $cbDPI, 27 * $cbDPI, 19 * $cbDPI, $hPen5) 768 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic3[0], 27 * $cbDPI, 9 * $cbDPI, 17 * $cbDPI, 19 * $cbDPI, $hPen5) 769 | Else 770 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic1[0], 17 * $cbDPI, 9 * $cbDPI, 27 * $cbDPI, 19 * $cbDPI, $hPen) 771 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic1[0], 27 * $cbDPI, 9 * $cbDPI, 17 * $cbDPI, 19 * $cbDPI, $hPen) 772 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic3[0], 17 * $cbDPI, 9 * $cbDPI, 27 * $cbDPI, 19 * $cbDPI, $hPen4) 773 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic3[0], 27 * $cbDPI, 9 * $cbDPI, 17 * $cbDPI, 19 * $cbDPI, $hPen4) 774 | EndIf 775 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic2[0], 17 * $cbDPI, 9 * $cbDPI, 27 * $cbDPI, 19 * $cbDPI, $hPen3) 776 | _GDIPlus_GraphicsDrawLine($Button_Close_Graphic2[0], 27 * $cbDPI, 9 * $cbDPI, 17 * $cbDPI, 19 * $cbDPI, $hPen3) 777 | EndIf 778 | ;============================================================================================================================= 779 | 780 | ;Create Maximize & Restore Button============================================================================================= 781 | If $ButtonsToCreate_Array[1] Then 782 | _GDIPlus_GraphicsDrawRect($Button_Maximize_Graphic1[0], Round(17 * $cbDPI), 9 * $cbDPI, 9 * $cbDPI, 9 * $cbDPI, $hPen) 783 | _GDIPlus_GraphicsDrawRect($Button_Maximize_Graphic2[0], Round(17 * $cbDPI), 9 * $cbDPI, 9 * $cbDPI, 9 * $cbDPI, $hPen2) 784 | _GDIPlus_GraphicsDrawRect($Button_Maximize_Graphic3[0], Round(17 * $cbDPI), 9 * $cbDPI, 9 * $cbDPI, 9 * $cbDPI, $hPen4) 785 | 786 | Local $kWH = Round(7 * $cbDPI), $resmargin = Round(2 * $cbDPI) 787 | _GDIPlus_GraphicsDrawRect($Button_Restore_Graphic1[0], Round(17 * $cbDPI) + $resmargin, (11 * $cbDPI) - $resmargin, $kWH, $kWH, $hPen) 788 | _GDIPlus_GraphicsFillRect($Button_Restore_Graphic1[0], Round(17 * $cbDPI), 11 * $cbDPI, $kWH, $kWH, $hBrush) 789 | _GDIPlus_GraphicsDrawRect($Button_Restore_Graphic1[0], Round(17 * $cbDPI), 11 * $cbDPI, $kWH, $kWH, $hPen) 790 | 791 | _GDIPlus_GraphicsDrawRect($Button_Restore_Graphic2[0], Round(17 * $cbDPI) + $resmargin, (11 * $cbDPI) - $resmargin, $kWH, $kWH, $hPen2) 792 | _GDIPlus_GraphicsFillRect($Button_Restore_Graphic2[0], Round(17 * $cbDPI), 11 * $cbDPI, $kWH, $kWH, $hBrush2) 793 | _GDIPlus_GraphicsDrawRect($Button_Restore_Graphic2[0], Round(17 * $cbDPI), 11 * $cbDPI, $kWH, $kWH, $hPen2) 794 | 795 | _GDIPlus_GraphicsDrawRect($Button_Restore_Graphic3[0], Round(17 * $cbDPI) + $resmargin, (11 * $cbDPI) - $resmargin, $kWH, $kWH, $hPen4) 796 | _GDIPlus_GraphicsFillRect($Button_Restore_Graphic3[0], Round(17 * $cbDPI), 11 * $cbDPI, $kWH, $kWH, $hBrush) 797 | _GDIPlus_GraphicsDrawRect($Button_Restore_Graphic3[0], Round(17 * $cbDPI), 11 * $cbDPI, $kWH, $kWH, $hPen4) 798 | EndIf 799 | ;============================================================================================================================= 800 | 801 | 802 | ;Create Minimize Button======================================================================================================= 803 | If $ButtonsToCreate_Array[2] Then 804 | _GDIPlus_GraphicsDrawLine($Button_Minimize_Graphic1[0], 18 * $cbDPI, 14 * $cbDPI, 27 * $cbDPI, 14 * $cbDPI, $hPen) 805 | _GDIPlus_GraphicsDrawLine($Button_Minimize_Graphic2[0], 18 * $cbDPI, 14 * $cbDPI, 27 * $cbDPI, 14 * $cbDPI, $hPen2) 806 | _GDIPlus_GraphicsDrawLine($Button_Minimize_Graphic3[0], 18 * $cbDPI, 14 * $cbDPI, 27 * $cbDPI, 14 * $cbDPI, $hPen4) 807 | EndIf 808 | ;============================================================================================================================= 809 | 810 | ;Create FullScreen / Fullscreen Restore Button================================================================================ 811 | If $ButtonsToCreate_Array[3] Then 812 | 813 | ;Calc size+pos 814 | Local $Cutpoint = ($FrameSize * 0.3) 815 | Local $LowerLinePos[2], $UpperLinePos 816 | $LowerLinePos[0] = Round($CBw / 2.9) 817 | $LowerLinePos[1] = Round($CBh / 1.5) 818 | $UpperLinePos = cAngle($LowerLinePos[0], $LowerLinePos[1], 135, $CBw / 2.5) 819 | $UpperLinePos[0] = Round($UpperLinePos[0]) 820 | $UpperLinePos[1] = Round($UpperLinePos[1]) 821 | 822 | ;Add arrow1 823 | Local $apos1 = cAngle($LowerLinePos[0] + $Cutpoint, $LowerLinePos[1] + $Cutpoint, 180, 5 * $cbDPI) 824 | Local $apos2 = cAngle($LowerLinePos[0] - $Cutpoint, $LowerLinePos[1] - $Cutpoint, 90, 5 * $cbDPI) 825 | 826 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic1[0], $LowerLinePos[0] + $Cutpoint, $LowerLinePos[1] + $Cutpoint, $apos1[0], $apos1[1], $hPen) ;r 827 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic1[0], $LowerLinePos[0] - $Cutpoint, $LowerLinePos[1] - $Cutpoint, $apos2[0], $apos2[1], $hPen) ;l 828 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic2[0], $LowerLinePos[0] + $Cutpoint, $LowerLinePos[1] + $Cutpoint, $apos1[0], $apos1[1], $hPen) ;r 829 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic2[0], $LowerLinePos[0] - $Cutpoint, $LowerLinePos[1] - $Cutpoint, $apos2[0], $apos2[1], $hPen) ;l 830 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic3[0], $LowerLinePos[0] + $Cutpoint, $LowerLinePos[1] + $Cutpoint, $apos1[0], $apos1[1], $hPen4) ;r 831 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic3[0], $LowerLinePos[0] - $Cutpoint, $LowerLinePos[1] - $Cutpoint, $apos2[0], $apos2[1], $hPen4) ;l 832 | 833 | 834 | ;Add arrow2 835 | $apos1 = cAngle($UpperLinePos[0] + $Cutpoint, $UpperLinePos[1] + $Cutpoint, 270, 5 * $cbDPI) 836 | $apos2 = cAngle($UpperLinePos[0] - $Cutpoint, $UpperLinePos[1] - $Cutpoint, 0, 5 * $cbDPI) 837 | 838 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic1[0], $UpperLinePos[0] + $Cutpoint, $UpperLinePos[1] + $Cutpoint, $apos1[0], $apos1[1], $hPen) ;r 839 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic1[0], $UpperLinePos[0] - $Cutpoint, $UpperLinePos[1] - $Cutpoint, $apos2[0], $apos2[1], $hPen) ;l 840 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic2[0], $UpperLinePos[0] + $Cutpoint, $UpperLinePos[1] + $Cutpoint, $apos1[0], $apos1[1], $hPen) ;r 841 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic2[0], $UpperLinePos[0] - $Cutpoint, $UpperLinePos[1] - $Cutpoint, $apos2[0], $apos2[1], $hPen) ;l 842 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic3[0], $UpperLinePos[0] + $Cutpoint, $UpperLinePos[1] + $Cutpoint, $apos1[0], $apos1[1], $hPen4) ;r 843 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic3[0], $UpperLinePos[0] - $Cutpoint, $UpperLinePos[1] - $Cutpoint, $apos2[0], $apos2[1], $hPen4) ;l 844 | 845 | ;Add line 846 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic1[0], $LowerLinePos[0] + $Cutpoint, $LowerLinePos[1] - $Cutpoint, $UpperLinePos[0], $UpperLinePos[1], $hPen) ;r 847 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic2[0], $LowerLinePos[0] + $Cutpoint, $LowerLinePos[1] - $Cutpoint, $UpperLinePos[0], $UpperLinePos[1], $hPen) ;r 848 | _GDIPlus_GraphicsDrawLine($Button_FullScreen_Graphic3[0], $LowerLinePos[0] + $Cutpoint, $LowerLinePos[1] - $Cutpoint, $UpperLinePos[0], $UpperLinePos[1], $hPen4) ;r 849 | 850 | 851 | ;============================================================================================================================= 852 | 853 | 854 | ;Calc size+pos arrow 1 855 | $Cutpoint = ($FrameSize * 0.3) 856 | Local $mpX = Round($CBw / 2, 0), $mpY = Round($CBh / 2.35, 0) 857 | $apos1 = cAngle($mpX - $Cutpoint, $mpY - $Cutpoint, 90, 4 * $cbDPI) 858 | $apos2 = cAngle($mpX + $Cutpoint, $mpY + $Cutpoint, 180, 4 * $cbDPI) 859 | Local $apos4 = cAngle($mpX + $Cutpoint, $mpY - $Cutpoint, 135, 8 * $cbDPI) 860 | 861 | ;Add arrow1 862 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic1[0], $mpX - $Cutpoint, $mpY - $Cutpoint, $apos1[0], $apos1[1], $hPen) ;h 863 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic1[0], $mpX + $Cutpoint, $mpY + $Cutpoint, $apos2[0], $apos2[1], $hPen) ;v 864 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic2[0], $mpX - $Cutpoint, $mpY - $Cutpoint, $apos1[0], $apos1[1], $hPen) ;h 865 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic2[0], $mpX + $Cutpoint, $mpY + $Cutpoint, $apos2[0], $apos2[1], $hPen) ;v 866 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic3[0], $mpX - $Cutpoint, $mpY - $Cutpoint, $apos1[0], $apos1[1], $hPen4) ;h 867 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic3[0], $mpX + $Cutpoint, $mpY + $Cutpoint, $apos2[0], $apos2[1], $hPen4) ;v 868 | 869 | ;Calc size+pos arrow2 870 | $Cutpoint = ($FrameSize * 0.3) 871 | Local $mpX1 = Round($CBw / 2.2, 0), $mpY1 = Round($CBh / 2, 0) 872 | $apos1 = cAngle($mpX1 - $Cutpoint, $mpY1 - $Cutpoint, 360, 4 * $cbDPI) 873 | $apos2 = cAngle($mpX1 + $Cutpoint, $mpY1 + $Cutpoint, 270, 4 * $cbDPI) 874 | Local $apos3 = cAngle($mpX1 - $Cutpoint, $mpY1 + $Cutpoint, 315, 8 * $cbDPI) 875 | 876 | ;Add arrow2 877 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic1[0], $mpX1 - $Cutpoint, $mpY1 - $Cutpoint, $apos1[0], $apos1[1], $hPen) ;v 878 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic1[0], $mpX1 + $Cutpoint, $mpY1 + $Cutpoint, $apos2[0], $apos2[1], $hPen) ;h 879 | 880 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic2[0], $mpX1 - $Cutpoint, $mpY1 - $Cutpoint, $apos1[0], $apos1[1], $hPen) ;v 881 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic2[0], $mpX1 + $Cutpoint, $mpY1 + $Cutpoint, $apos2[0], $apos2[1], $hPen) ;h 882 | 883 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic3[0], $mpX1 - $Cutpoint, $mpY1 - $Cutpoint, $apos1[0], $apos1[1], $hPen4) ;v 884 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic3[0], $mpX1 + $Cutpoint, $mpY1 + $Cutpoint, $apos2[0], $apos2[1], $hPen4) ;h 885 | 886 | ;Add lines 887 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic1[0], $mpX1 - $Cutpoint, $mpY1 + $Cutpoint, $apos3[0] + $Cutpoint, $apos3[1] - $Cutpoint, $hPen) 888 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic1[0], $mpX + $Cutpoint, $mpY - $Cutpoint, $apos4[0] - $Cutpoint, $apos4[1] + $Cutpoint, $hPen) 889 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic2[0], $mpX1 - $Cutpoint, $mpY1 + $Cutpoint, $apos3[0] + $Cutpoint, $apos3[1] - $Cutpoint, $hPen) 890 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic2[0], $mpX + $Cutpoint, $mpY - $Cutpoint, $apos4[0] - $Cutpoint, $apos4[1] + $Cutpoint, $hPen) 891 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic3[0], $mpX1 - $Cutpoint, $mpY1 + $Cutpoint, $apos3[0] + $Cutpoint, $apos3[1] - $Cutpoint, $hPen4) 892 | _GDIPlus_GraphicsDrawLine($Button_FSRestore_Graphic3[0], $mpX + $Cutpoint, $mpY - $Cutpoint, $apos4[0] - $Cutpoint, $apos4[1] + $Cutpoint, $hPen4) 893 | 894 | EndIf 895 | ;============================================================================================================================= 896 | 897 | 898 | ;Create Menu Button=========================================================================================================== 899 | If $ButtonsToCreate_Array[4] Then 900 | _GDIPlus_GraphicsDrawLine($Button_Menu_Graphic1[0], $CBw / 3, $CBh / 2.9, ($CBw / 3) * 2, $CBh / 2.9, $hPen) ;r 901 | _GDIPlus_GraphicsDrawLine($Button_Menu_Graphic1[0], $CBw / 3, $CBh / 2.9 + ($FrameSize * 4), ($CBw / 3) * 2, $CBh / 2.9 + ($FrameSize * 4), $hPen) ;r 902 | _GDIPlus_GraphicsDrawLine($Button_Menu_Graphic1[0], $CBw / 3, $CBh / 2.9 + ($FrameSize * 8), ($CBw / 3) * 2, $CBh / 2.9 + ($FrameSize * 8), $hPen) ;r 903 | 904 | _GDIPlus_GraphicsDrawLine($Button_Menu_Graphic2[0], $CBw / 3, $CBh / 2.9, ($CBw / 3) * 2, $CBh / 2.9, $hPen) 905 | _GDIPlus_GraphicsDrawLine($Button_Menu_Graphic2[0], $CBw / 3, $CBh / 2.9 + ($FrameSize * 4), ($CBw / 3) * 2, $CBh / 2.9 + ($FrameSize * 4), $hPen) 906 | _GDIPlus_GraphicsDrawLine($Button_Menu_Graphic2[0], $CBw / 3, $CBh / 2.9 + ($FrameSize * 8), ($CBw / 3) * 2, $CBh / 2.9 + ($FrameSize * 8), $hPen) 907 | 908 | _GDIPlus_GraphicsDrawLine($Button_Menu_Graphic3[0], $CBw / 3, $CBh / 2.9, ($CBw / 3) * 2, $CBh / 2.9, $hPen4) 909 | _GDIPlus_GraphicsDrawLine($Button_Menu_Graphic3[0], $CBw / 3, $CBh / 2.9 + ($FrameSize * 4), ($CBw / 3) * 2, $CBh / 2.9 + ($FrameSize * 4), $hPen4) 910 | _GDIPlus_GraphicsDrawLine($Button_Menu_Graphic3[0], $CBw / 3, $CBh / 2.9 + ($FrameSize * 8), ($CBw / 3) * 2, $CBh / 2.9 + ($FrameSize * 8), $hPen4) 911 | EndIf 912 | ;============================================================================================================================= 913 | 914 | ;Release resources 915 | _GDIPlus_PenDispose($hPen) 916 | _GDIPlus_PenDispose($hPen2) 917 | _GDIPlus_PenDispose($hPen3) 918 | _GDIPlus_PenDispose($hPen4) 919 | _GDIPlus_PenDispose($hPen5) 920 | _GDIPlus_BrushDispose($hBrush) 921 | _GDIPlus_BrushDispose($hBrush2) 922 | 923 | ;Create bitmap handles 924 | If $ButtonsToCreate_Array[0] Then 925 | $Button_Close_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_Close_Array[0], $Button_Close_Graphic1) 926 | $Button_Close_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_Close_Array[0], $Button_Close_Graphic2, False) 927 | $Button_Close_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Button_Close_Array[0], $Button_Close_Graphic3, False) 928 | GUICtrlSetResizing($Button_Close_Array[0], 768 + 32 + 4) 929 | $Control_Buttons[0] = $Button_Close_Array[0] 930 | _Internal_AddHoverItem($Button_Close_Array) 931 | EndIf 932 | If $ButtonsToCreate_Array[1] Then 933 | $Button_Maximize_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_Maximize_Array[0], $Button_Maximize_Graphic1) 934 | $Button_Maximize_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_Maximize_Array[0], $Button_Maximize_Graphic2, False) 935 | $Button_Maximize_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Button_Maximize_Array[0], $Button_Maximize_Graphic3, False) 936 | $Button_Restore_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_Restore_Array[0], $Button_Restore_Graphic1) 937 | $Button_Restore_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_Restore_Array[0], $Button_Restore_Graphic2, False) 938 | $Button_Restore_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Button_Restore_Array[0], $Button_Restore_Graphic3, False) 939 | GUICtrlSetResizing($Button_Maximize_Array[0], 768 + 32 + 4) 940 | GUICtrlSetResizing($Button_Restore_Array[0], 768 + 32 + 4) 941 | 942 | $Control_Buttons[1] = $Button_Maximize_Array[0] 943 | $Control_Buttons[2] = $Button_Restore_Array[0] 944 | GUICtrlSetState($Button_Restore_Array[0], 32) 945 | _Internal_AddHoverItem($Button_Maximize_Array) 946 | _Internal_AddHoverItem($Button_Restore_Array) 947 | EndIf 948 | 949 | If $ButtonsToCreate_Array[2] Then 950 | $Button_Minimize_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_Minimize_Array[0], $Button_Minimize_Graphic1) 951 | $Button_Minimize_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_Minimize_Array[0], $Button_Minimize_Graphic2, False) 952 | $Button_Minimize_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Button_Minimize_Array[0], $Button_Minimize_Graphic3, False) 953 | GUICtrlSetResizing($Button_Minimize_Array[0], 768 + 32 + 4) 954 | $Control_Buttons[3] = $Button_Minimize_Array[0] 955 | _Internal_AddHoverItem($Button_Minimize_Array) 956 | EndIf 957 | 958 | If $ButtonsToCreate_Array[3] Then 959 | $Button_FullScreen_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_FullScreen_Array[0], $Button_FullScreen_Graphic1) 960 | $Button_FullScreen_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_FullScreen_Array[0], $Button_FullScreen_Graphic2, False) 961 | $Button_FullScreen_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Button_FullScreen_Array[0], $Button_FullScreen_Graphic3, False) 962 | 963 | $Button_FSRestore_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_FSRestore_Array[0], $Button_FSRestore_Graphic1) 964 | $Button_FSRestore_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_FSRestore_Array[0], $Button_FSRestore_Graphic2, False) 965 | $Button_FSRestore_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Button_FSRestore_Array[0], $Button_FSRestore_Graphic3, False) 966 | 967 | GUICtrlSetResizing($Button_FullScreen_Array[0], 768 + 32 + 4) 968 | GUICtrlSetResizing($Button_FSRestore_Array[0], 768 + 32 + 4) 969 | GUICtrlSetState($Button_FSRestore_Array[0], 32) 970 | 971 | $Control_Buttons[4] = $Button_FullScreen_Array[0] 972 | $Control_Buttons[5] = $Button_FSRestore_Array[0] 973 | _Internal_AddHoverItem($Button_FullScreen_Array) 974 | _Internal_AddHoverItem($Button_FSRestore_Array) 975 | EndIf 976 | 977 | If $ButtonsToCreate_Array[4] Then 978 | $Button_Menu_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_Menu_Array[0], $Button_Menu_Graphic1) 979 | $Button_Menu_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_Menu_Array[0], $Button_Menu_Graphic2, False) 980 | $Button_Menu_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Button_Menu_Array[0], $Button_Menu_Graphic3, False) 981 | GUICtrlSetResizing($Button_Menu_Array[0], 768 + 32 + 2) 982 | $Control_Buttons[6] = $Button_Menu_Array[0] 983 | _Internal_AddHoverItem($Button_Menu_Array) 984 | EndIf 985 | 986 | Return $Control_Buttons 987 | EndFunc ;==>_Internal_CreateControlButtons 988 | 989 | #EndRegion MetroGUI=========================================================================================== 990 | 991 | 992 | 993 | #Region MetroButtons=========================================================================================== 994 | ; =============================================================================================================================== 995 | ; Name ..........: _Metro_CreateButton 996 | ; Description ...: Creates metro style buttons. Hovering creates a frame around the buttons. 997 | ; Syntax ........: _Metro_CreateButton($Text, $Left, $Top, $Width, $Height[, $BGColor = $ButtonBKColor[, 998 | ; $FontColor = $ButtonTextColor[, $Font = "Arial"[, $Fontsize = 12.5[, $FontStyle = 1 $FrameColor = "0xFFFFFF"]]]]]) 999 | ; Parameters ....: $Text - Text of the button. 1000 | ; $Left - Left pos. 1001 | ; $Top - Top pos. 1002 | ; $Width - Width. 1003 | ; $Height - Height. 1004 | ; $BGColor - [optional] Button background color. Default is $ButtonBKColor. 1005 | ; $FontColor - [optional] Font colore. Default is $ButtonTextColor. 1006 | ; $Font - [optional] Font. Default is "Arial". 1007 | ; $Fontsize - [optional] Fontsize. Default is 12.5. 1008 | ; $FontStyle - [optional] Fontstyle. Default is 1. 1009 | ; $FrameColor - [optional] Button frame color. Default is "0xFFFFFF". 1010 | ; Return values .: Handle to the button. 1011 | ; Example .......: _Metro_CreateButton("Button 1",50,50,120,34) 1012 | ; =============================================================================================================================== 1013 | 1014 | Func _Metro_CreateButton($Text, $Left, $Top, $Width, $Height, $BG_Color = $ButtonBKColor, $Font_Color = $ButtonTextColor, $Font = "Arial", $Fontsize = 11, $FontStyle = 1, $FrameColor = "0xFFFFFF") 1015 | Local $Button_Array[16] 1016 | 1017 | Local $btnDPI = _HighDPICheck() 1018 | ;HighDPI Support 1019 | If $HIGHDPI_SUPPORT Then 1020 | $Left = Round($Left * $gDPI) 1021 | $Top = Round($Top * $gDPI) 1022 | $Width = Round($Width * $gDPI) 1023 | $Height = Round($Height * $gDPI) 1024 | Else 1025 | $Fontsize = ($Fontsize / $Font_DPI_Ratio) 1026 | EndIf 1027 | 1028 | $Button_Array[1] = False ; Set hover OFF 1029 | $Button_Array[3] = "2" ; Type 1030 | $Button_Array[15] = GetCurrentGUI() 1031 | 1032 | ;Calculate Framesize 1033 | Local $FrameSize = Round(4 * $btnDPI) 1034 | If Not (Mod($FrameSize, 2) = 0) Then $FrameSize = $FrameSize - 1 1035 | 1036 | ;Set Colors 1037 | $BG_Color = "0xFF" & Hex($BG_Color, 6) 1038 | $Font_Color = "0xFF" & Hex($Font_Color, 6) 1039 | $FrameColor = "0xFF" & Hex($FrameColor, 6) 1040 | Local $Brush_BTN_FontColor = _GDIPlus_BrushCreateSolid($Font_Color) 1041 | Local $Brush_BTN_FontColorDis = _GDIPlus_BrushCreateSolid(StringReplace(_AlterBrightness($Font_Color, -30), "0x", "0xFF")) 1042 | Local $Pen_BTN_FrameHoverColor = _GDIPlus_PenCreate($FrameColor, $FrameSize) 1043 | 1044 | ;Create Button graphics 1045 | Local $Button_Graphic1 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5) ;Default 1046 | Local $Button_Graphic2 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5) ;Hover 1047 | Local $Button_Graphic3 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5) ;Disabled 1048 | 1049 | ;Create font, Set font options 1050 | Local $hFormat = _GDIPlus_StringFormatCreate(), $hFamily = _GDIPlus_FontFamilyCreate($Font), $hFont = _GDIPlus_FontCreate($hFamily, $Fontsize, $FontStyle) 1051 | Local $tLayout = _GDIPlus_RectFCreate(0, 0, $Width, $Height) 1052 | _GDIPlus_StringFormatSetAlign($hFormat, 1) 1053 | _GDIPlus_StringFormatSetLineAlign($hFormat, 1) 1054 | 1055 | ;Draw button text 1056 | _GDIPlus_GraphicsDrawStringEx($Button_Graphic1[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1057 | _GDIPlus_GraphicsDrawStringEx($Button_Graphic2[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1058 | _GDIPlus_GraphicsDrawStringEx($Button_Graphic3[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColorDis) 1059 | 1060 | ;Add frame 1061 | _GDIPlus_GraphicsDrawRect($Button_Graphic2[0], 0, 0, $Width, $Height, $Pen_BTN_FrameHoverColor) 1062 | 1063 | ;Release created objects 1064 | _GDIPlus_FontDispose($hFont) 1065 | _GDIPlus_FontFamilyDispose($hFamily) 1066 | _GDIPlus_StringFormatDispose($hFormat) 1067 | _GDIPlus_BrushDispose($Brush_BTN_FontColor) 1068 | _GDIPlus_BrushDispose($Brush_BTN_FontColorDis) 1069 | _GDIPlus_PenDispose($Pen_BTN_FrameHoverColor) 1070 | 1071 | ;Set graphic and return Bitmap handle 1072 | $Button_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height) 1073 | $Button_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_Array[0], $Button_Graphic1) 1074 | $Button_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_Array[0], $Button_Graphic2, False) 1075 | $Button_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Button_Array[0], $Button_Graphic3, False) 1076 | 1077 | ;For GUI Resizing 1078 | GUICtrlSetResizing($Button_Array[0], 768) 1079 | 1080 | _Internal_AddHoverItem($Button_Array) 1081 | Return $Button_Array[0] 1082 | EndFunc ;==>_Metro_CreateButton 1083 | 1084 | ; #FUNCTION# ==================================================================================================================== 1085 | ; Name ..........: _Metro_CreateButtonEx 1086 | ; Description ...: Creates Windows 10 style buttons with a frame around. Hovering changes the button color to a lighter color. 1087 | ; Syntax ........: _Metro_CreateButtonEx($Text, $Left, $Top, $Width, $Height[, $BG_Color = $ButtonBKColor[, 1088 | ; $Font_Color = $ButtonTextColor[, $Font = "Arial"[, $Fontsize = 12.5[, $FontStyle = 1[, 1089 | ; $FrameColor = "0xFFFFFF"]]]]]]) 1090 | ; Parameters ....: $Text - Text of the button. 1091 | ; $Left - Left pos. 1092 | ; $Top - Top pos. 1093 | ; $Width - Width. 1094 | ; $Height - Height. 1095 | ; $BG_Color - [optional] Button background color. Default is $ButtonBKColor. 1096 | ; $Font_Color - [optional] Font colore. Default is $ButtonTextColor. 1097 | ; $Font - [optional] Font. Default is "Arial". 1098 | ; $Fontsize - [optional] Fontsize. Default is 12.5. 1099 | ; $FontStyle - [optional] Fontstyle. Default is 1. 1100 | ; $FrameColor - [optional] Button frame color. Default is "0xFFFFFF". 1101 | ; Return values .: Handle to the button. 1102 | ; Example .......: _Metro_CreateButtonEx("Button 1",50,50,120,34) 1103 | ; =============================================================================================================================== 1104 | 1105 | Func _Metro_CreateButtonEx($Text, $Left, $Top, $Width, $Height, $BG_Color = $ButtonBKColor, $Font_Color = $ButtonTextColor, $Font = "Arial", $Fontsize = 11, $FontStyle = 1, $FrameColor = "0xFFFFFF") 1106 | Local $Button_Array[16] 1107 | 1108 | Local $btnDPI = _HighDPICheck() 1109 | If $HIGHDPI_SUPPORT Then 1110 | $Left = Round($Left * $gDPI) 1111 | $Top = Round($Top * $gDPI) 1112 | $Width = Round($Width * $gDPI) 1113 | $Height = Round($Height * $gDPI) 1114 | Else 1115 | $Fontsize = ($Fontsize / $Font_DPI_Ratio) 1116 | EndIf 1117 | 1118 | $Button_Array[1] = False ; Set hover OFF 1119 | $Button_Array[3] = "2" ; Type 1120 | $Button_Array[15] = GetCurrentGUI() 1121 | 1122 | ;Calculate Framesize 1123 | Local $FrameSize = Round(2 * $btnDPI) 1124 | If Not (Mod($FrameSize, 2) = 0) Then $FrameSize = $FrameSize - 1 1125 | 1126 | ;Set Colors 1127 | $BG_Color = "0xFF" & Hex($BG_Color, 6) 1128 | $Font_Color = "0xFF" & Hex($Font_Color, 6) 1129 | $FrameColor = "0xFF" & Hex($FrameColor, 6) 1130 | Local $Brush_BTN_FontColor = _GDIPlus_BrushCreateSolid($Font_Color) 1131 | Local $Pen_BTN_FrameHoverColor = _GDIPlus_PenCreate($FrameColor, $FrameSize) 1132 | Local $Pen_BTN_FrameHoverColorDis = _GDIPlus_PenCreate(StringReplace(_AlterBrightness($Font_Color, -30), "0x", "0xFF"), $FrameSize) 1133 | Local $Brush_BTN_FontColorDis = _GDIPlus_BrushCreateSolid(StringReplace(_AlterBrightness($Font_Color, -30), "0x", "0xFF")) 1134 | 1135 | ;Create Button graphics 1136 | Local $Button_Graphic1 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5) ;Default 1137 | Local $Button_Graphic2 = _GDIPlusGraphic_Create($Width, $Height, StringReplace(_AlterBrightness($BG_Color, 25), "0x", "0xFF"), 0, 5) ;Hover 1138 | Local $Button_Graphic3 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5) ;Disabled 1139 | 1140 | ;Create font, Set font options 1141 | Local $hFormat = _GDIPlus_StringFormatCreate(), $hFamily = _GDIPlus_FontFamilyCreate($Font), $hFont = _GDIPlus_FontCreate($hFamily, $Fontsize, $FontStyle) 1142 | Local $tLayout = _GDIPlus_RectFCreate(0, 0, $Width, $Height) 1143 | _GDIPlus_StringFormatSetAlign($hFormat, 1) 1144 | _GDIPlus_StringFormatSetLineAlign($hFormat, 1) 1145 | 1146 | ;Draw button text 1147 | _GDIPlus_GraphicsDrawStringEx($Button_Graphic1[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1148 | _GDIPlus_GraphicsDrawStringEx($Button_Graphic2[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1149 | _GDIPlus_GraphicsDrawStringEx($Button_Graphic3[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColorDis) 1150 | 1151 | ;Add frame 1152 | _GDIPlus_GraphicsDrawRect($Button_Graphic1[0], 0, 0, $Width, $Height, $Pen_BTN_FrameHoverColor) 1153 | _GDIPlus_GraphicsDrawRect($Button_Graphic2[0], 0, 0, $Width, $Height, $Pen_BTN_FrameHoverColor) 1154 | _GDIPlus_GraphicsDrawRect($Button_Graphic3[0], 0, 0, $Width, $Height, $Pen_BTN_FrameHoverColorDis) 1155 | 1156 | ;Release created objects 1157 | _GDIPlus_FontDispose($hFont) 1158 | _GDIPlus_FontFamilyDispose($hFamily) 1159 | _GDIPlus_StringFormatDispose($hFormat) 1160 | _GDIPlus_BrushDispose($Brush_BTN_FontColor) 1161 | _GDIPlus_BrushDispose($Brush_BTN_FontColorDis) 1162 | _GDIPlus_PenDispose($Pen_BTN_FrameHoverColor) 1163 | _GDIPlus_PenDispose($Pen_BTN_FrameHoverColorDis) 1164 | 1165 | ;Set graphic and return Bitmap handle 1166 | $Button_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height) 1167 | $Button_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Button_Array[0], $Button_Graphic1) 1168 | $Button_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Button_Array[0], $Button_Graphic2, False) 1169 | $Button_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Button_Array[0], $Button_Graphic3, False) 1170 | 1171 | ;Set GUI Resizing 1172 | GUICtrlSetResizing($Button_Array[0], 768) 1173 | 1174 | _Internal_AddHoverItem($Button_Array) 1175 | Return $Button_Array[0] 1176 | 1177 | EndFunc ;==>_Metro_CreateButtonEx 1178 | 1179 | ; #FUNCTION# ==================================================================================================================== 1180 | ; Name ..........: _Metro_DisableButton 1181 | ; Description ...: Disables a Button and makes the font grayed out to indicate that the button is disabled. 1182 | ; Syntax ........: _Metro_DisableButton($mButton) 1183 | ; Parameters ....: $mButton - Handle to the button. 1184 | ; Example .......: _Metro_DisableButton($Button1) 1185 | ; =============================================================================================================================== 1186 | Func _Metro_DisableButton($mButton) 1187 | Local $CurrentGUI = GetCurrentGUI() 1188 | GUICtrlSetState($mButton, 128) 1189 | For $i_BTN = 0 To (UBound($GLOBAL_HOVER_REG) - 1) 1190 | If ($GLOBAL_HOVER_REG[$i_BTN][0] = $mButton) And ($GLOBAL_HOVER_REG[$i_BTN][15] = $CurrentGUI) Then 1191 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][7])) 1192 | EndIf 1193 | Next 1194 | EndFunc ;==>_Metro_DisableButton 1195 | 1196 | ; #FUNCTION# ==================================================================================================================== 1197 | ; Name ..........: _Metro_EnableButton 1198 | ; Description ...: Enables a metro style button and reverts the grayed out font style. 1199 | ; Syntax ........: _Metro_EnableButton($mButton) 1200 | ; Parameters ....: $mButton - Handle to the button. 1201 | ; =============================================================================================================================== 1202 | Func _Metro_EnableButton($mButton) 1203 | Local $CurrentGUI = GetCurrentGUI() 1204 | GUICtrlSetState($mButton, 64) 1205 | For $i_BTN = 0 To (UBound($GLOBAL_HOVER_REG) - 1) 1206 | If ($GLOBAL_HOVER_REG[$i_BTN][0] = $mButton) And ($GLOBAL_HOVER_REG[$i_BTN][15] = $CurrentGUI) Then 1207 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][5])) 1208 | EndIf 1209 | Next 1210 | EndFunc ;==>_Metro_EnableButton 1211 | 1212 | 1213 | #EndRegion MetroButtons=========================================================================================== 1214 | 1215 | #Region Metro Toggles=========================================================================================== 1216 | 1217 | ; #FUNCTION# ==================================================================================================================== 1218 | ; Name ..........: _Metro_CreateToggle(NEW WIN10 Style) 1219 | ; Description ...: Creates a Windows 10 style toggle with a text on the right side. 1220 | ; Syntax ........: _Metro_CreateToggle($Text, $Left, $Top, $Width, $Height[, $BG_Color = $GUIThemeColor[, 1221 | ; $Font_Color = $FontThemeColor[, $Font = "Segoe UI"[, $FontSize = "11"]]]]) 1222 | ; Parameters ....: 1223 | ; $Text - Text to be displayed on the right side of the GUI. 1224 | ; $Left - Left pos 1225 | ; $Top - Top pos. 1226 | ; $Width - Width 1227 | ; $Height - Height 1228 | ; $BG_Color - [optional] Background color. Default is $GUIThemeColor. 1229 | ; $Font_Color - [optional] Font color. Default is $FontThemeColor. 1230 | ; $Font - [optional] Font. Default is "Segoe UI". 1231 | ; $FontSize - [optional] Fontsize. Default is "11". 1232 | ; Return values .: Handle to the toggle. 1233 | ; =============================================================================================================================== 1234 | Func _Metro_CreateToggle($Text, $Left, $Top, $Width, $Height, $BG_Color = $GUIThemeColor, $Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "11") 1235 | Local $Text1 = $Text 1236 | If $Height < 20 Then 1237 | If (@Compiled = 0) Then MsgBox(48, "Metro UDF", "The min. height is 20px for metro toggles.") 1238 | EndIf 1239 | If $Width < 46 Then 1240 | If (@Compiled = 0) Then MsgBox(48, "Metro UDF", "The min. width for metro toggles must be at least 46px without any text!") 1241 | EndIf 1242 | If Not (Mod($Height, 2) = 0) Then 1243 | If (@Compiled = 0) Then MsgBox(48, "Metro UDF", "The toggle height should be an even number to prevent any misplacing.") 1244 | EndIf 1245 | ;HighDPI Support 1246 | Local $pDPI = _HighDPICheck() 1247 | If $HIGHDPI_SUPPORT = True Then 1248 | $Left = Round($Left * $gDPI) 1249 | $Top = Round($Top * $gDPI) 1250 | $Width = Round($Width * $gDPI) 1251 | $Height = Round($Height * $gDPI) 1252 | If Not (Mod($Height, 2) = 0) Then $Height = $Height + 1 1253 | Else 1254 | $Fontsize = ($Fontsize / $Font_DPI_Ratio) 1255 | EndIf 1256 | 1257 | Local $Toggle_Array[16] 1258 | $Toggle_Array[1] = False ; Hover 1259 | $Toggle_Array[2] = False ; Checked State 1260 | $Toggle_Array[3] = "6" ; Type 1261 | $Toggle_Array[15] = GetCurrentGUI() 1262 | 1263 | ;Calc pos/sizes 1264 | Local $TopMargCalc = Number(20 * $pDPI, 1) 1265 | If Not (Mod($TopMargCalc, 2) = 0) Then $TopMargCalc = $TopMargCalc + 1 1266 | Local $TopMargCalc1 = Number(12 * $pDPI, 1) 1267 | If Not (Mod($TopMargCalc1, 2) = 0) Then $TopMargCalc1 = $TopMargCalc1 + 1 1268 | Local $TopMargin = Number((($Height - $TopMargCalc) / 2), 1) 1269 | Local $TopMarginCircle = Number((($Height - $TopMargCalc1) / 2), 1) 1270 | Local $iRadius = 10 * $pDPI 1271 | Local $hFWidth = Number(50 * $pDPI, 1) 1272 | If Not (Mod($hFWidth, 2) = 0) Then $hFWidth = $hFWidth + 1 1273 | Local $togSizeW = Number(46 * $pDPI, 1) 1274 | If Not (Mod($togSizeW, 2) = 0) Then $togSizeW = $togSizeW + 1 1275 | Local $togSizeH = Number(20 * $pDPI, 1) 1276 | If Not (Mod($togSizeH, 2) = 0) Then $togSizeH = $togSizeH + 1 1277 | Local $tog_calc1 = Number(2 * $pDPI, 1) 1278 | Local $tog_calc2 = Number(3 * $pDPI, 1) 1279 | Local $tog_calc3 = Number(11 * $pDPI, 1) 1280 | Local $tog_calc5 = Number(6 * $pDPI, 1) 1281 | 1282 | ;Set Colors 1283 | $BG_Color = "0xFF" & Hex($BG_Color, 6) 1284 | $Font_Color = "0xFF" & Hex($Font_Color, 6) 1285 | Local $Brush_BTN_FontColor = _GDIPlus_BrushCreateSolid($Font_Color) 1286 | Local $Brush_BTN_FontColor1 = _GDIPlus_BrushCreateSolid(StringReplace($CB_Radio_Color, "0x", "0xFF")) 1287 | 1288 | If StringInStr($GUI_Theme_Name, "Light") Then 1289 | Local $BoxFrameCol = StringReplace(_AlterBrightness($Font_Color, +45), "0x", "0xFF") 1290 | Local $BoxFrameCol1 = StringReplace(_AlterBrightness($Font_Color, +30), "0x", "0xFF") 1291 | Local $Font_Color1 = StringReplace(_AlterBrightness($Font_Color, +60), "0x", "0xFF") 1292 | Else 1293 | Local $BoxFrameCol = StringReplace(_AlterBrightness($Font_Color, -45), "0x", "0xFF") 1294 | Local $BoxFrameCol1 = StringReplace(_AlterBrightness($Font_Color, -45), "0x", "0xFF") 1295 | Local $Font_Color1 = StringReplace(_AlterBrightness($Font_Color, -30), "0x", "0xFF") 1296 | EndIf 1297 | 1298 | ;Unchecked 1299 | Local $BrushInnerUC = _GDIPlus_BrushCreateSolid($BG_Color) 1300 | Local $BrushCircleUC = _GDIPlus_BrushCreateSolid($Font_Color) 1301 | Local $BrushCircleHoverUC = _GDIPlus_BrushCreateSolid($BoxFrameCol1) 1302 | Local $hPenDefaultUC = _GDIPlus_PenCreate($Font_Color, 2 * $pDPI) 1303 | Local $hPenHoverUC = _GDIPlus_PenCreate($BoxFrameCol1, 2 * $pDPI) 1304 | 1305 | ;Checked 1306 | Local $BrushInnerC = _GDIPlus_BrushCreateSolid(StringReplace($ButtonBKColor, "0x", "0xFF")) 1307 | Local $BrushInnerCHover = _GDIPlus_BrushCreateSolid(StringReplace(_AlterBrightness($ButtonBKColor, +15), "0x", "0xFF")) 1308 | Local $BrushCircleC = _GDIPlus_BrushCreateSolid(StringReplace($ButtonTextColor, "0x", "0xFF")) 1309 | Local $hPenDefaultC = _GDIPlus_PenCreate(StringReplace($ButtonBKColor, "0x", "0xFF"), 2 * $pDPI) 1310 | Local $hPenHoverC = _GDIPlus_PenCreate(StringReplace(_AlterBrightness($ButtonBKColor, +15), "0x", "0xFF"), 2 * $pDPI) 1311 | 1312 | ;Create graphics 1313 | Local $Toggle_Graphic1 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5), $Toggle_Graphic2 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5), $Toggle_Graphic3 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5), $Toggle_Graphic4 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5), $Toggle_Graphic5 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5), $Toggle_Graphic6 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5), $Toggle_Graphic7 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5), $Toggle_Graphic8 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5), $Toggle_Graphic9 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5), $Toggle_Graphic10 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5) 1314 | 1315 | ;Set font options 1316 | Local $hFormat = _GDIPlus_StringFormatCreate(), $hFamily = _GDIPlus_FontFamilyCreate($Font), $hFont = _GDIPlus_FontCreate($hFamily, $Fontsize, 0) 1317 | Local $tLayout = _GDIPlus_RectFCreate($hFWidth, 0, $Width - $hFWidth, $Height) 1318 | _GDIPlus_StringFormatSetAlign($hFormat, 1) 1319 | _GDIPlus_StringFormatSetLineAlign($hFormat, 1) 1320 | 1321 | ;Draw text 1322 | If StringInStr($Text, "|@|") Then 1323 | $Text1 = StringRegExp($Text, "\|@\|(.+)", 1) 1324 | If Not @error Then $Text1 = $Text1[0] 1325 | $Text = StringRegExp($Text, "^(.+)\|@\|", 1) 1326 | If Not @error Then $Text = $Text[0] 1327 | EndIf 1328 | 1329 | 1330 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic1[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1331 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic2[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1332 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic3[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1333 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic4[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1334 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic5[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1335 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic6[0], $Text1, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1336 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic7[0], $Text1, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1337 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic8[0], $Text1, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1338 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic9[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1339 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic10[0], $Text1, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1340 | 1341 | ;Default state 1342 | Local $hPath1 = _GDIPlus_PathCreate() 1343 | _GDIPlus_PathAddArc($hPath1, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1344 | _GDIPlus_PathAddArc($hPath1, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1345 | _GDIPlus_PathAddArc($hPath1, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1346 | _GDIPlus_PathAddArc($hPath1, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1347 | _GDIPlus_PathCloseFigure($hPath1) 1348 | _GDIPlus_GraphicsFillPath($Toggle_Graphic1[0], $hPath1, $BrushInnerUC) 1349 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic1[0], $hPath1, $hPenDefaultUC) 1350 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic1[0], 6 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleUC) 1351 | 1352 | ;Default hover state 1353 | Local $hPath2 = _GDIPlus_PathCreate() 1354 | _GDIPlus_PathAddArc($hPath2, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1355 | _GDIPlus_PathAddArc($hPath2, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1356 | _GDIPlus_PathAddArc($hPath2, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1357 | _GDIPlus_PathAddArc($hPath2, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1358 | _GDIPlus_PathCloseFigure($hPath2) 1359 | _GDIPlus_GraphicsFillPath($Toggle_Graphic9[0], $hPath2, $BrushInnerUC) 1360 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic9[0], $hPath2, $hPenHoverUC) 1361 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic9[0], 6 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleHoverUC) 1362 | 1363 | ;CheckedStep1 1364 | Local $hPath3 = _GDIPlus_PathCreate() 1365 | _GDIPlus_PathAddArc($hPath3, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1366 | _GDIPlus_PathAddArc($hPath3, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1367 | _GDIPlus_PathAddArc($hPath3, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1368 | _GDIPlus_PathAddArc($hPath3, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1369 | _GDIPlus_PathCloseFigure($hPath3) 1370 | _GDIPlus_GraphicsFillPath($Toggle_Graphic2[0], $hPath3, $BrushInnerUC) 1371 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic2[0], $hPath3, $hPenHoverUC) 1372 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic2[0], 10 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleHoverUC) 1373 | 1374 | ;CheckedStep2 1375 | Local $hPath4 = _GDIPlus_PathCreate() 1376 | _GDIPlus_PathAddArc($hPath4, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1377 | _GDIPlus_PathAddArc($hPath4, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1378 | _GDIPlus_PathAddArc($hPath4, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1379 | _GDIPlus_PathAddArc($hPath4, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1380 | _GDIPlus_PathCloseFigure($hPath4) 1381 | _GDIPlus_GraphicsFillPath($Toggle_Graphic3[0], $hPath4, $BrushInnerUC) 1382 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic3[0], $hPath4, $hPenHoverUC) 1383 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic3[0], 14 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleHoverUC) 1384 | 1385 | ;CheckedStep3 1386 | Local $hPath5 = _GDIPlus_PathCreate() 1387 | _GDIPlus_PathAddArc($hPath5, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1388 | _GDIPlus_PathAddArc($hPath5, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1389 | _GDIPlus_PathAddArc($hPath5, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1390 | _GDIPlus_PathAddArc($hPath5, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1391 | _GDIPlus_PathCloseFigure($hPath5) 1392 | _GDIPlus_GraphicsFillPath($Toggle_Graphic4[0], $hPath5, $BrushInnerUC) 1393 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic4[0], $hPath5, $hPenHoverUC) 1394 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic4[0], 18 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleHoverUC) 1395 | 1396 | ;CheckedStep4 1397 | Local $hPath6 = _GDIPlus_PathCreate() 1398 | _GDIPlus_PathAddArc($hPath6, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1399 | _GDIPlus_PathAddArc($hPath6, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1400 | _GDIPlus_PathAddArc($hPath6, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1401 | _GDIPlus_PathAddArc($hPath6, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1402 | _GDIPlus_PathCloseFigure($hPath6) 1403 | _GDIPlus_GraphicsFillPath($Toggle_Graphic5[0], $hPath6, $BrushInnerUC) 1404 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic5[0], $hPath6, $hPenHoverUC) 1405 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic5[0], 22 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleHoverUC) 1406 | 1407 | ;CheckedStep5 1408 | Local $hPath7 = _GDIPlus_PathCreate() 1409 | _GDIPlus_PathAddArc($hPath7, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1410 | _GDIPlus_PathAddArc($hPath7, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1411 | _GDIPlus_PathAddArc($hPath7, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1412 | _GDIPlus_PathAddArc($hPath7, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1413 | _GDIPlus_PathCloseFigure($hPath7) 1414 | _GDIPlus_GraphicsFillPath($Toggle_Graphic6[0], $hPath7, $BrushInnerCHover) 1415 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic6[0], $hPath7, $hPenHoverC) 1416 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic6[0], 26 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleC) 1417 | 1418 | ;CheckedStep6 1419 | Local $hPath8 = _GDIPlus_PathCreate() 1420 | _GDIPlus_PathAddArc($hPath8, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1421 | _GDIPlus_PathAddArc($hPath8, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1422 | _GDIPlus_PathAddArc($hPath8, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1423 | _GDIPlus_PathAddArc($hPath8, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1424 | _GDIPlus_PathCloseFigure($hPath8) 1425 | _GDIPlus_GraphicsFillPath($Toggle_Graphic7[0], $hPath8, $BrushInnerCHover) 1426 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic7[0], $hPath8, $hPenHoverC) 1427 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic7[0], 30 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleC) 1428 | 1429 | ;Final checked state 1430 | Local $hPath9 = _GDIPlus_PathCreate() 1431 | _GDIPlus_PathAddArc($hPath9, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1432 | _GDIPlus_PathAddArc($hPath9, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1433 | _GDIPlus_PathAddArc($hPath9, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1434 | _GDIPlus_PathAddArc($hPath9, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1435 | _GDIPlus_PathCloseFigure($hPath9) 1436 | _GDIPlus_GraphicsFillPath($Toggle_Graphic8[0], $hPath9, $BrushInnerC) 1437 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic8[0], $hPath9, $hPenDefaultC) 1438 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic8[0], 34 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleC) 1439 | 1440 | ;Final checked state hover 1441 | Local $hPath10 = _GDIPlus_PathCreate() 1442 | _GDIPlus_PathAddArc($hPath10, 0 + $hFWidth - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 1443 | _GDIPlus_PathAddArc($hPath10, 0 + $hFWidth - ($iRadius * 2), $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 1444 | _GDIPlus_PathAddArc($hPath10, 1 * $pDPI, $TopMargin + (20 * $pDPI) - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 1445 | _GDIPlus_PathAddArc($hPath10, 1 * $pDPI, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 1446 | _GDIPlus_PathCloseFigure($hPath10) 1447 | _GDIPlus_GraphicsFillPath($Toggle_Graphic10[0], $hPath10, $BrushInnerCHover) 1448 | _GDIPlus_GraphicsDrawPath($Toggle_Graphic10[0], $hPath10, $hPenHoverC) 1449 | _GDIPlus_GraphicsFillEllipse($Toggle_Graphic10[0], 34 * $pDPI, $TopMarginCircle, 12 * $pDPI, 12 * $pDPI, $BrushCircleC) 1450 | 1451 | ;Release created objects 1452 | _GDIPlus_FontDispose($hFont) 1453 | _GDIPlus_FontFamilyDispose($hFamily) 1454 | _GDIPlus_StringFormatDispose($hFormat) 1455 | _GDIPlus_BrushDispose($Brush_BTN_FontColor) 1456 | _GDIPlus_BrushDispose($Brush_BTN_FontColor1) 1457 | _GDIPlus_BrushDispose($BrushInnerUC) 1458 | _GDIPlus_BrushDispose($BrushCircleUC) 1459 | _GDIPlus_BrushDispose($BrushCircleHoverUC) 1460 | _GDIPlus_BrushDispose($BrushInnerC) 1461 | _GDIPlus_BrushDispose($BrushInnerCHover) 1462 | _GDIPlus_BrushDispose($BrushCircleC) 1463 | _GDIPlus_PenDispose($hPenDefaultUC) 1464 | _GDIPlus_PenDispose($hPenHoverUC) 1465 | _GDIPlus_PenDispose($hPenDefaultC) 1466 | _GDIPlus_PenDispose($hPenHoverC) 1467 | _GDIPlus_PathDispose($hPath1) 1468 | _GDIPlus_PathDispose($hPath2) 1469 | _GDIPlus_PathDispose($hPath3) 1470 | _GDIPlus_PathDispose($hPath4) 1471 | _GDIPlus_PathDispose($hPath5) 1472 | _GDIPlus_PathDispose($hPath6) 1473 | _GDIPlus_PathDispose($hPath7) 1474 | _GDIPlus_PathDispose($hPath8) 1475 | _GDIPlus_PathDispose($hPath9) 1476 | _GDIPlus_PathDispose($hPath10) 1477 | 1478 | ;Create bitmap handles and set graphics 1479 | $Toggle_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height) 1480 | $Toggle_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic1) 1481 | $Toggle_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic2, False) 1482 | $Toggle_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic3, False) 1483 | $Toggle_Array[8] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic4, False) 1484 | $Toggle_Array[9] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic5, False) 1485 | $Toggle_Array[10] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic6, False) 1486 | $Toggle_Array[11] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic7, False) 1487 | $Toggle_Array[12] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic8, False) 1488 | $Toggle_Array[13] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic9, False) 1489 | $Toggle_Array[14] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic10, False) 1490 | 1491 | ;Set Control Resizing 1492 | GUICtrlSetResizing($Toggle_Array[0], 768) 1493 | 1494 | ;Add to GUI_HOVER_REG 1495 | _Internal_AddHoverItem($Toggle_Array) 1496 | 1497 | Return $Toggle_Array[0] 1498 | EndFunc ;==>_Metro_CreateToggle 1499 | 1500 | ; #FUNCTION# ==================================================================================================================== 1501 | ; Name ..........: _Metro_CreateToggleEx 1502 | ; Description ...: Creates a Windows 8 style toggle with a text on the right side. 1503 | ; Syntax ........: _Metro_CreateToggle($Text, $Left, $Top, $Width, $Height[, $BG_Color = $GUIThemeColor[, 1504 | ; $Font_Color = $FontThemeColor[, $Font = "Segoe UI"[, $FontSize = "11"]]]]) 1505 | ; Parameters ....: 1506 | ; $Text - Text to be displayed on the right side of the GUI. 1507 | ; $Left - Left pos 1508 | ; $Top - Top pos. 1509 | ; $Width - Width 1510 | ; $Height - Height 1511 | ; $BG_Color - [optional] Background color. Default is $GUIThemeColor. 1512 | ; $Font_Color - [optional] Font color. Default is $FontThemeColor. 1513 | ; $Font - [optional] Font. Default is "Segoe UI". 1514 | ; $FontSize - [optional] Fontsize. Default is "11". 1515 | ; Return values .: Handle to the toggle. 1516 | ; =============================================================================================================================== 1517 | Func _Metro_CreateToggleEX($Text, $Left, $Top, $Width, $Height, $BG_Color = $GUIThemeColor, $Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "11") 1518 | Local $pDPI = _HighDPICheck(), $Text1 = $Text 1519 | 1520 | If $Height < 20 Then 1521 | If (@Compiled = 0) Then MsgBox(48, "Metro UDF", "The min. height is 20px for metro toggles.") 1522 | EndIf 1523 | If $Width < 46 Then 1524 | If (@Compiled = 0) Then MsgBox(48, "Metro UDF", "The min. width for metro toggles must be at least 46px without any text!") 1525 | EndIf 1526 | If Not (Mod($Height, 2) = 0) Then 1527 | If (@Compiled = 0) Then MsgBox(48, "Metro UDF", "The toggle height should be an even number to prevent any misplacing.") 1528 | EndIf 1529 | 1530 | ;HighDPI Support 1531 | If $HIGHDPI_SUPPORT Then 1532 | $Left = Round($Left * $gDPI) 1533 | $Top = Round($Top * $gDPI) 1534 | $Width = Round($Width * $gDPI) 1535 | $Height = Round($Height * $gDPI) 1536 | If Not (Mod($Height, 2) = 0) Then $Height = $Height + 1 1537 | Else 1538 | $Fontsize = ($Fontsize / $Font_DPI_Ratio) 1539 | EndIf 1540 | 1541 | ;Create Toggle Array 1542 | Local $Toggle_Array[16] 1543 | $Toggle_Array[1] = False ; Hover 1544 | $Toggle_Array[2] = False ; Checked State 1545 | $Toggle_Array[3] = "6" ; Type 1546 | $Toggle_Array[15] = GetCurrentGUI() 1547 | 1548 | ;calc pos/sizes 1549 | Local $TopMargCalc = Number(20 * $pDPI, 1) 1550 | If Not (Mod($TopMargCalc, 2) = 0) Then $TopMargCalc = $TopMargCalc + 1 1551 | Local $TopMargin = Number((($Height - $TopMargCalc) / 2), 1) 1552 | Local $hFWidth = Number(50 * $pDPI, 1) 1553 | If Not (Mod($hFWidth, 2) = 0) Then $hFWidth = $hFWidth + 1 1554 | Local $togSizeW = Number(46 * $pDPI, 1) 1555 | If Not (Mod($togSizeW, 2) = 0) Then $togSizeW = $togSizeW + 1 1556 | Local $togSizeH = Number(20 * $pDPI, 1) 1557 | If Not (Mod($togSizeH, 2) = 0) Then $togSizeH = $togSizeH + 1 1558 | Local $tog_calc1 = Number(2 * $pDPI, 1) 1559 | Local $tog_calc2 = Number(3 * $pDPI, 1) 1560 | Local $tog_calc3 = Number(11 * $pDPI, 1) 1561 | Local $tog_calc5 = Number(6 * $pDPI, 1) 1562 | 1563 | ;Set Colors 1564 | $BG_Color = "0xFF" & Hex($BG_Color, 6) 1565 | $Font_Color = "0xFF" & Hex($Font_Color, 6) 1566 | Local $Brush_BTN_FontColor = _GDIPlus_BrushCreateSolid($Font_Color) 1567 | Local $Brush_BTN_FontColor1 = _GDIPlus_BrushCreateSolid(StringReplace($CB_Radio_Color, "0x", "0xFF")) 1568 | 1569 | If StringInStr($GUI_Theme_Name, "Light") Then 1570 | Local $BoxFrameCol = StringReplace(_AlterBrightness($Font_Color, +45), "0x", "0xFF") 1571 | Local $BoxFrameCol1 = StringReplace(_AlterBrightness($Font_Color, +35), "0x", "0xFF") 1572 | Local $Font_Color1 = StringReplace(_AlterBrightness($Font_Color, +60), "0x", "0xFF") 1573 | Else 1574 | Local $BoxFrameCol = StringReplace(_AlterBrightness($Font_Color, -45), "0x", "0xFF") 1575 | Local $BoxFrameCol1 = StringReplace(_AlterBrightness($Font_Color, -55), "0x", "0xFF") 1576 | Local $Font_Color1 = StringReplace(_AlterBrightness($Font_Color, -30), "0x", "0xFF") 1577 | EndIf 1578 | 1579 | ;Unchecked 1580 | Local $Brush1 = _GDIPlus_BrushCreateSolid($BoxFrameCol) ;Inner 1581 | Local $Brush2 = _GDIPlus_BrushCreateSolid($BoxFrameCol1) ;Outerframe 1582 | Local $Brush3 = _GDIPlus_BrushCreateSolid($Font_Color1) ;InnerHover 1583 | ;Checked 1584 | Local $Brush4 = _GDIPlus_BrushCreateSolid(StringReplace($ButtonBKColor, "0x", "0xFF")) ;Inner 1585 | Local $Brush5 = _GDIPlus_BrushCreateSolid(StringReplace(_AlterBrightness($ButtonBKColor, -10), "0x", "0xFF")) ;Outerframe 1586 | Local $Brush6 = _GDIPlus_BrushCreateSolid(StringReplace(_AlterBrightness($ButtonBKColor, +15), "0x", "0xFF")) ;InnerHover 1587 | 1588 | ;Create graphics 1589 | Local $Toggle_Graphic1 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5), $Toggle_Graphic2 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5), $Toggle_Graphic3 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5), $Toggle_Graphic4 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5), $Toggle_Graphic5 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5), $Toggle_Graphic6 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5), $Toggle_Graphic7 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5), $Toggle_Graphic8 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5), $Toggle_Graphic9 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5), $Toggle_Graphic10 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 0, 5) 1590 | 1591 | ;Set font 1592 | Local $hFormat = _GDIPlus_StringFormatCreate(), $hFamily = _GDIPlus_FontFamilyCreate($Font), $hFont = _GDIPlus_FontCreate($hFamily, $Fontsize, 0) 1593 | Local $tLayout = _GDIPlus_RectFCreate($hFWidth, 0, $Width - $hFWidth, $Height) 1594 | _GDIPlus_StringFormatSetAlign($hFormat, 1) 1595 | _GDIPlus_StringFormatSetLineAlign($hFormat, 1) 1596 | 1597 | ;Draw text 1598 | If StringInStr($Text, "|@|") Then 1599 | $Text1 = StringRegExp($Text, "\|@\|(.+)", 1) 1600 | If Not @error Then $Text1 = $Text1[0] 1601 | $Text = StringRegExp($Text, "^(.+)\|@\|", 1) 1602 | If Not @error Then $Text = $Text[0] 1603 | EndIf 1604 | 1605 | 1606 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic1[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1607 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic2[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1608 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic3[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1609 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic4[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1610 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic5[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1611 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic6[0], $Text1, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1612 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic7[0], $Text1, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1613 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic8[0], $Text1, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1614 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic9[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1615 | _GDIPlus_GraphicsDrawStringEx($Toggle_Graphic10[0], $Text1, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1616 | 1617 | ;Default state 1618 | _GDIPlus_GraphicsFillRect($Toggle_Graphic1[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush2) ; Toggle Background 1619 | _GDIPlus_GraphicsFillRect($Toggle_Graphic1[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush1) ;Toggle Inner 1620 | _GDIPlus_GraphicsFillRect($Toggle_Graphic1[0], 0, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) ; Toggle Slider 1621 | 1622 | ;Default hover state 1623 | _GDIPlus_GraphicsFillRect($Toggle_Graphic9[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush2) 1624 | _GDIPlus_GraphicsFillRect($Toggle_Graphic9[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush3) 1625 | _GDIPlus_GraphicsFillRect($Toggle_Graphic9[0], 0, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) 1626 | 1627 | ;CheckedStep1 1628 | _GDIPlus_GraphicsFillRect($Toggle_Graphic2[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush2) 1629 | _GDIPlus_GraphicsFillRect($Toggle_Graphic2[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush3) 1630 | _GDIPlus_GraphicsFillRect($Toggle_Graphic2[0], 5 * $pDPI, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) 1631 | 1632 | ;CheckedStep2 1633 | _GDIPlus_GraphicsFillRect($Toggle_Graphic3[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush2) 1634 | _GDIPlus_GraphicsFillRect($Toggle_Graphic3[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush3) 1635 | _GDIPlus_GraphicsFillRect($Toggle_Graphic3[0], 10 * $pDPI, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) 1636 | 1637 | ;CheckedStep3 1638 | _GDIPlus_GraphicsFillRect($Toggle_Graphic4[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush2) 1639 | _GDIPlus_GraphicsFillRect($Toggle_Graphic4[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush3) 1640 | _GDIPlus_GraphicsFillRect($Toggle_Graphic4[0], 15 * $pDPI, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) 1641 | 1642 | ;CheckedStep4 1643 | _GDIPlus_GraphicsFillRect($Toggle_Graphic5[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush5) 1644 | _GDIPlus_GraphicsFillRect($Toggle_Graphic5[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush6) 1645 | _GDIPlus_GraphicsFillRect($Toggle_Graphic5[0], $togSizeH, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) 1646 | 1647 | ;CheckedStep5 1648 | _GDIPlus_GraphicsFillRect($Toggle_Graphic6[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush5) 1649 | _GDIPlus_GraphicsFillRect($Toggle_Graphic6[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush6) 1650 | _GDIPlus_GraphicsFillRect($Toggle_Graphic6[0], 25 * $pDPI, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) 1651 | 1652 | ;CheckedStep6 1653 | _GDIPlus_GraphicsFillRect($Toggle_Graphic7[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush5) 1654 | _GDIPlus_GraphicsFillRect($Toggle_Graphic7[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush6) 1655 | _GDIPlus_GraphicsFillRect($Toggle_Graphic7[0], 30 * $pDPI, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) 1656 | 1657 | ;Final checked state 1658 | _GDIPlus_GraphicsFillRect($Toggle_Graphic8[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush5) 1659 | _GDIPlus_GraphicsFillRect($Toggle_Graphic8[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush4) 1660 | _GDIPlus_GraphicsFillRect($Toggle_Graphic8[0], $togSizeW - $tog_calc3, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) 1661 | 1662 | ;Final checked state hover 1663 | _GDIPlus_GraphicsFillRect($Toggle_Graphic10[0], 0, $TopMargin, $togSizeW, $togSizeH, $Brush5) 1664 | _GDIPlus_GraphicsFillRect($Toggle_Graphic10[0], $tog_calc2, $TopMargin + $tog_calc2, $togSizeW - $tog_calc5, $togSizeH - $tog_calc5, $Brush6) 1665 | _GDIPlus_GraphicsFillRect($Toggle_Graphic10[0], $togSizeW - $tog_calc3, $TopMargin, $tog_calc3, $togSizeH, $Brush_BTN_FontColor1) 1666 | 1667 | ;Release created objects 1668 | _GDIPlus_FontDispose($hFont) 1669 | _GDIPlus_FontFamilyDispose($hFamily) 1670 | _GDIPlus_StringFormatDispose($hFormat) 1671 | _GDIPlus_BrushDispose($Brush_BTN_FontColor) 1672 | _GDIPlus_BrushDispose($Brush_BTN_FontColor1) 1673 | _GDIPlus_BrushDispose($Brush1) 1674 | _GDIPlus_BrushDispose($Brush2) 1675 | _GDIPlus_BrushDispose($Brush3) 1676 | _GDIPlus_BrushDispose($Brush4) 1677 | _GDIPlus_BrushDispose($Brush5) 1678 | _GDIPlus_BrushDispose($Brush6) 1679 | 1680 | ;Create bitmap handles and set graphics 1681 | $Toggle_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height) 1682 | $Toggle_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic1) 1683 | $Toggle_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic2, False) 1684 | $Toggle_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic3, False) 1685 | $Toggle_Array[8] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic4, False) 1686 | $Toggle_Array[9] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic5, False) 1687 | $Toggle_Array[10] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic6, False) 1688 | $Toggle_Array[11] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic7, False) 1689 | $Toggle_Array[12] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic8, False) 1690 | $Toggle_Array[13] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic9, False) 1691 | $Toggle_Array[14] = _GDIPlusGraphic_CreateBitmapHandle($Toggle_Array[0], $Toggle_Graphic10, False) 1692 | 1693 | ;Set GUI Resizing 1694 | GUICtrlSetResizing($Toggle_Array[0], 768) 1695 | 1696 | ;Add to GUI_HOVER_REG 1697 | _Internal_AddHoverItem($Toggle_Array) 1698 | 1699 | Return $Toggle_Array[0] 1700 | EndFunc ;==>_Metro_CreateToggleEX 1701 | 1702 | ; #FUNCTION# ==================================================================================================================== 1703 | ; Name ..........: _Metro_CreateToggle 1704 | ; Description ...: Creates a Windows 10 style on/off toggle with custom "enable/disable" text. 1705 | ; Syntax ........: _Metro_CreateToggle($Text, $Left, $Top, $Width, $Height[, $BG_Color = $GUIThemeColor[, 1706 | ; $Font_Color = $FontThemeColor[, $Font = "Segoe UI"[, $FontSize = "11"]]]]) 1707 | ; Parameters ....: 1708 | ; $OnText - Text to be displayed when the toggle is checked 1709 | ; $OffText - Text to be displayed when the toggle is unchecked 1710 | ; $Left - Left pos 1711 | ; $Top - Top pos. 1712 | ; $Width - Width 1713 | ; $Height - Height 1714 | ; $BG_Color - [optional] Background color. Default is $GUIThemeColor. 1715 | ; $Font_Color - [optional] Font color. Default is $FontThemeColor. 1716 | ; $Font - [optional] Font. Default is "Segoe UI". 1717 | ; $FontSize - [optional] Fontsize. Default is "11". 1718 | ; Return values .: Handle to the toggle. 1719 | ; =============================================================================================================================== 1720 | Func _Metro_CreateOnOffToggle($OnText, $OffText, $Left, $Top, $Width, $Height, $BG_Color = $GUIThemeColor, $Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "11") 1721 | Return _Metro_CreateToggle($OffText & "|@|" & $OnText, $Left, $Top, $Width, $Height, $BG_Color, $Font_Color, $Font, $Fontsize) 1722 | EndFunc ;==>_Metro_CreateOnOffToggle 1723 | 1724 | ; #FUNCTION# ==================================================================================================================== 1725 | ; Name ..........: _Metro_CreateToggleEx 1726 | ; Description ...: Creates a Windows 8 style on/off toggle with custom "enable/disable" text. 1727 | ; Syntax ........: _Metro_CreateToggle($Text, $Left, $Top, $Width, $Height[, $BG_Color = $GUIThemeColor[, 1728 | ; $Font_Color = $FontThemeColor[, $Font = "Segoe UI"[, $FontSize = "11"]]]]) 1729 | ; Parameters ....: 1730 | ; $OnText - Text to be displayed when the toggle is checked 1731 | ; $OffText - Text to be displayed when the toggle is unchecked 1732 | ; $Left - Left pos 1733 | ; $Top - Top pos. 1734 | ; $Width - Width 1735 | ; $Height - Height 1736 | ; $BG_Color - [optional] Background color. Default is $GUIThemeColor. 1737 | ; $Font_Color - [optional] Font color. Default is $FontThemeColor. 1738 | ; $Font - [optional] Font. Default is "Segoe UI". 1739 | ; $FontSize - [optional] Fontsize. Default is "11". 1740 | ; Return values .: Handle to the toggle. 1741 | ; =============================================================================================================================== 1742 | Func _Metro_CreateOnOffToggleEx($OnText, $OffText, $Left, $Top, $Width, $Height, $BG_Color = $GUIThemeColor, $Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "11") 1743 | Return _Metro_CreateToggleEX($OffText & "|@|" & $OnText, $Left, $Top, $Width, $Height, $BG_Color, $Font_Color, $Font, $Fontsize) 1744 | EndFunc ;==>_Metro_CreateOnOffToggleEx 1745 | 1746 | 1747 | ; #FUNCTION# ==================================================================================================================== 1748 | ; Name ..........: _Metro_ToggleIsChecked 1749 | ; Description ...: Checks if a toggle is checked 1750 | ; Syntax ........: _Metro_ToggleIsChecked($Toggle) 1751 | ; Parameters ....: $Toggle - Handle of the toggle. 1752 | ; Return values .: True / False 1753 | ; =============================================================================================================================== 1754 | Func _Metro_ToggleIsChecked($Toggle) 1755 | For $i = 0 To (UBound($GLOBAL_HOVER_REG) - 1) Step +1 1756 | If $GLOBAL_HOVER_REG[$i][0] = $Toggle Then 1757 | If $GLOBAL_HOVER_REG[$i][2] Then 1758 | Return True 1759 | Else 1760 | Return False 1761 | EndIf 1762 | EndIf 1763 | Next 1764 | EndFunc ;==>_Metro_ToggleIsChecked 1765 | 1766 | 1767 | ; #FUNCTION# ==================================================================================================================== 1768 | ; Name ..........: _Metro_ToggleUnCheck 1769 | ; Description ...: Unchecks a toggle 1770 | ; Syntax ........: _Metro_ToggleUnCheck($Toggle[, $NoAnimation = False]) 1771 | ; Parameters ....: $Toggle - Handle to the toggle 1772 | ; $NoAnimation - [optional] True/False. Default is False. - Unchecks the toggle instantly without animation. 1773 | ; =============================================================================================================================== 1774 | Func _Metro_ToggleUnCheck($Toggle, $NoAnimation = False) 1775 | For $i = 0 To (UBound($GLOBAL_HOVER_REG) - 1) Step +1 1776 | If $GLOBAL_HOVER_REG[$i][0] = $Toggle Then 1777 | If $GLOBAL_HOVER_REG[$i][2] Then 1778 | If Not $NoAnimation Then 1779 | For $i2 = 12 To 6 Step -1 1780 | _WinAPI_DeleteObject(GUICtrlSendMsg($Toggle, 0x0172, 0, $GLOBAL_HOVER_REG[$i][$i2])) 1781 | Sleep(1) 1782 | Next 1783 | _WinAPI_DeleteObject(GUICtrlSendMsg($Toggle, 0x0172, 0, $GLOBAL_HOVER_REG[$i][13])) 1784 | Else 1785 | _WinAPI_DeleteObject(GUICtrlSendMsg($Toggle, 0x0172, 0, $GLOBAL_HOVER_REG[$i][13])) 1786 | EndIf 1787 | $GLOBAL_HOVER_REG[$i][1] = True 1788 | $GLOBAL_HOVER_REG[$i][2] = False 1789 | ExitLoop 1790 | EndIf 1791 | EndIf 1792 | Next 1793 | EndFunc ;==>_Metro_ToggleUnCheck 1794 | 1795 | 1796 | ; #FUNCTION# ==================================================================================================================== 1797 | ; Name ..........: _Metro_ToggleCheck 1798 | ; Description ...: Checks a toggle 1799 | ; Syntax ........: _Metro_ToggleCheck($Toggle[, $NoAnimation = False]) 1800 | ; Parameters ....: $Toggle - Handle to the toggle. 1801 | ; $NoAnimation - [optional] True/False. Default is False. - Checks the Toggle instantly without an animation. Should be used when creating a gui with a checked toggle before the gui is shown. 1802 | ; =============================================================================================================================== 1803 | Func _Metro_ToggleCheck($Toggle, $NoAnimation = False) 1804 | For $i = 0 To (UBound($GLOBAL_HOVER_REG) - 1) Step +1 1805 | If $GLOBAL_HOVER_REG[$i][0] = $Toggle Then 1806 | If Not $GLOBAL_HOVER_REG[$i][2] Then 1807 | If Not $NoAnimation Then 1808 | For $i2 = 6 To 11 Step +1 1809 | _WinAPI_DeleteObject(GUICtrlSendMsg($Toggle, 0x0172, 0, $GLOBAL_HOVER_REG[$i][$i2])) 1810 | Sleep(1) 1811 | Next 1812 | _WinAPI_DeleteObject(GUICtrlSendMsg($Toggle, 0x0172, 0, $GLOBAL_HOVER_REG[$i][14])) 1813 | Else 1814 | _WinAPI_DeleteObject(GUICtrlSendMsg($Toggle, 0x0172, 0, $GLOBAL_HOVER_REG[$i][14])) 1815 | EndIf 1816 | $GLOBAL_HOVER_REG[$i][2] = True 1817 | $GLOBAL_HOVER_REG[$i][1] = True 1818 | ExitLoop 1819 | EndIf 1820 | EndIf 1821 | Next 1822 | EndFunc ;==>_Metro_ToggleCheck 1823 | #EndRegion Metro Toggles=========================================================================================== 1824 | 1825 | 1826 | #Region MetroRadio=========================================================================================== 1827 | ; #FUNCTION# ==================================================================================================================== 1828 | ; Name ..........: _Metro_CreateRadio 1829 | ; Description ...: Creates a metro style radio. 1830 | ; Syntax ........: _Metro_CreateRadio($RadioGroup, $Text, $Left, $Top, $Width, $Height[, $BG_Color = $GUIThemeColor[, 1831 | ; $Font_Color = $FontThemeColor[, $Font = "Segoe UI"[, $FontSize = "11"[, $FontStyle = 0]]]]]) 1832 | ; Parameters ....: $RadioGroup - A radiogroup to assign the radio to. You can use numbers or any text. 1833 | ; $Text - Text. 1834 | ; $Left - Left pos. 1835 | ; $Top - Top pos. 1836 | ; $Width - Width. 1837 | ; $Height - Height. 1838 | ; $BG_Color - [optional] Background color. Default is $GUIThemeColor. 1839 | ; $Font_Color - [optional] Font color. Default is $FontThemeColor. 1840 | ; $Font - [optional] Font. Default is "Segoe UI". 1841 | ; $FontSize - [optional] Fontsize. Default is "11". 1842 | ; $FontStyle - [optional] Fontstyle. Default is 0. 1843 | ; $$RadioCircleSize - [optional] Custom circle size for radio. 1844 | ; Return values .: Handle to the radio. 1845 | ; =============================================================================================================================== 1846 | Func _Metro_CreateRadio($RadioGroup, $Text, $Left, $Top, $Width, $Height, $BG_Color = $GUIThemeColor, $Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "11", $FontStyle = 0, $RadioCircleSize = 22) 1847 | If $Height < 22 And $RadioCircleSize > 21 Then 1848 | If (@Compiled = 0) Then MsgBox(48, "Metro UDF", "The min. height is 22px for metro radios.") 1849 | EndIf 1850 | 1851 | ;HighDPI Support 1852 | Local $rDPI = _HighDPICheck() 1853 | If $HIGHDPI_SUPPORT Then 1854 | $Left = Round($Left * $gDPI) 1855 | $Top = Round($Top * $gDPI) 1856 | $Width = Round($Width * $gDPI) 1857 | $Height = Round($Height * $gDPI) 1858 | If Not (Mod($Width, 2) = 0) Then $Width = $Width - 1 1859 | If Not (Mod($Height, 2) = 0) Then $Height = $Height - 1 1860 | $RadioCircleSize = $RadioCircleSize * $gDPI 1861 | If Not (Mod($RadioCircleSize, 2) = 0) Then $RadioCircleSize = $RadioCircleSize - 1 1862 | Else 1863 | $Fontsize = ($Fontsize / $Font_DPI_Ratio) 1864 | EndIf 1865 | 1866 | Local $Radio_Array[16] 1867 | $Radio_Array[1] = False ; Hover 1868 | $Radio_Array[2] = False ; Checkmark 1869 | $Radio_Array[3] = "7" ; Type 1870 | $Radio_Array[4] = $RadioGroup ; Radiogroup 1871 | $Radio_Array[15] = GetCurrentGUI() 1872 | 1873 | ;Set position 1874 | Local $TopMargin = ($Height - $RadioCircleSize) / 2 1875 | 1876 | ;Set Colors 1877 | $BG_Color = "0xFF" & Hex($BG_Color, 6) 1878 | $Font_Color = "0xFF" & Hex($Font_Color, 6) 1879 | Local $Brush_BTN_FontColor = _GDIPlus_BrushCreateSolid($Font_Color) 1880 | Local $BoxFrameCol = StringReplace($CB_Radio_Hover_Color, "0x", "0xFF") 1881 | Local $Brush1 = _GDIPlus_BrushCreateSolid(StringReplace($CB_Radio_Color, "0x", "0xFF")) 1882 | Local $Brush2 = _GDIPlus_BrushCreateSolid(StringReplace($CB_Radio_CheckMark_Color, "0x", "0xFF")) 1883 | Local $Brush3 = _GDIPlus_BrushCreateSolid(StringReplace($CB_Radio_Hover_Color, "0x", "0xFF")) 1884 | 1885 | ;Create graphics 1886 | Local $Radio_Graphic1 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5) ;default state 1887 | Local $Radio_Graphic2 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5) ;checked state 1888 | Local $Radio_Graphic3 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5) ;default hover state 1889 | Local $Radio_Graphic4 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5) ;checked hover state 1890 | 1891 | ;Create font, Set font options 1892 | Local $hFormat = _GDIPlus_StringFormatCreate(), $hFamily = _GDIPlus_FontFamilyCreate($Font), $hFont = _GDIPlus_FontCreate($hFamily, $Fontsize, $FontStyle) 1893 | Local $tLayout = _GDIPlus_RectFCreate(30 * $rDPI, 0, $Width - (30 * $rDPI), $Height) 1894 | _GDIPlus_StringFormatSetAlign($hFormat, 1) 1895 | _GDIPlus_StringFormatSetLineAlign($hFormat, 1) 1896 | $tLayout.Y = 1 1897 | 1898 | ;Draw radio text 1899 | _GDIPlus_GraphicsDrawStringEx($Radio_Graphic1[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1900 | _GDIPlus_GraphicsDrawStringEx($Radio_Graphic2[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1901 | _GDIPlus_GraphicsDrawStringEx($Radio_Graphic3[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1902 | _GDIPlus_GraphicsDrawStringEx($Radio_Graphic4[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 1903 | 1904 | ;Add Circle Background 1905 | Local $radSize1 = 1 * $rDPI 1906 | Local $radSize2 = 5 * $rDPI 1907 | Local $radSize3 = 11 * $rDPI 1908 | 1909 | ;Default state 1910 | _GDIPlus_GraphicsFillEllipse($Radio_Graphic1[0], 0, $TopMargin, $RadioCircleSize - $radSize1, $RadioCircleSize - $radSize1, $Brush1) 1911 | 1912 | ;Default hover state 1913 | _GDIPlus_GraphicsFillEllipse($Radio_Graphic3[0], 0, $TopMargin, $RadioCircleSize - $radSize1, $RadioCircleSize - $radSize1, $Brush3) 1914 | 1915 | ;Checked state 1916 | _GDIPlus_GraphicsFillEllipse($Radio_Graphic2[0], 0, $TopMargin, $RadioCircleSize - $radSize1, $RadioCircleSize - $radSize1, $Brush1) 1917 | _GDIPlus_GraphicsFillEllipse($Radio_Graphic2[0], $radSize2, $TopMargin + $radSize2, $RadioCircleSize - $radSize3, $RadioCircleSize - $radSize3, $Brush2) 1918 | 1919 | ;Checked hover state 1920 | _GDIPlus_GraphicsFillEllipse($Radio_Graphic4[0], 0, $TopMargin, $RadioCircleSize - $radSize1, $RadioCircleSize - $radSize1, $Brush3) 1921 | _GDIPlus_GraphicsFillEllipse($Radio_Graphic4[0], $radSize2, $TopMargin + $radSize2, $RadioCircleSize - $radSize3, $RadioCircleSize - $radSize3, $Brush2) 1922 | 1923 | ;Release created objects 1924 | _GDIPlus_FontDispose($hFont) 1925 | _GDIPlus_FontFamilyDispose($hFamily) 1926 | _GDIPlus_StringFormatDispose($hFormat) 1927 | _GDIPlus_BrushDispose($Brush_BTN_FontColor) 1928 | _GDIPlus_BrushDispose($Brush1) 1929 | _GDIPlus_BrushDispose($Brush2) 1930 | _GDIPlus_BrushDispose($Brush3) 1931 | 1932 | ;Create bitmap handles and set graphics 1933 | $Radio_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height) 1934 | $Radio_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Radio_Array[0], $Radio_Graphic1) 1935 | $Radio_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Radio_Array[0], $Radio_Graphic2, False) 1936 | $Radio_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Radio_Array[0], $Radio_Graphic3, False) 1937 | $Radio_Array[8] = _GDIPlusGraphic_CreateBitmapHandle($Radio_Array[0], $Radio_Graphic4, False) 1938 | 1939 | ;Set GUI Resizing 1940 | GUICtrlSetResizing($Radio_Array[0], 768) 1941 | 1942 | ;Add Hover effects 1943 | _Internal_AddHoverItem($Radio_Array) 1944 | 1945 | Return $Radio_Array[0] 1946 | EndFunc ;==>_Metro_CreateRadio 1947 | 1948 | 1949 | ; #FUNCTION# ==================================================================================================================== 1950 | ; Name ..........: _Metro_RadioCheck 1951 | ; Description ...: Checks the selected radio and unchecks all other radios in the same radiogroup. 1952 | ; Syntax ........: _Metro_RadioCheck($RadioGroup, $Radio) 1953 | ; Parameters ....: $RadioGroup - The group that the radio has been assigned to. 1954 | ; $Radio - Handle to the radio. 1955 | ; =============================================================================================================================== 1956 | Func _Metro_RadioCheck($RadioGroup, $Radio) 1957 | For $i = 0 To (UBound($GLOBAL_HOVER_REG) - 1) Step +1 1958 | If $GLOBAL_HOVER_REG[$i][0] = $Radio Then 1959 | $GLOBAL_HOVER_REG[$i][1] = True 1960 | $GLOBAL_HOVER_REG[$i][2] = True 1961 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i][8])) 1962 | Else 1963 | If $GLOBAL_HOVER_REG[$i][4] = $RadioGroup Then 1964 | $GLOBAL_HOVER_REG[$i][2] = False 1965 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i][5])) 1966 | EndIf 1967 | EndIf 1968 | Next 1969 | EndFunc ;==>_Metro_RadioCheck 1970 | #EndRegion MetroRadio=========================================================================================== 1971 | 1972 | ; #FUNCTION# ==================================================================================================================== 1973 | ; Name ..........: _Metro_RadioIsChecked 1974 | ; Description ...: Checks if a metro radio is checked. 1975 | ; Syntax ........: _Metro_RadioIsChecked($RadioGroup, $Radio) 1976 | ; Parameters ....: $RadioGroup - Radio group 1977 | ; $Radio - Handle to the radio 1978 | ; Return values .: True / False 1979 | ; =============================================================================================================================== 1980 | Func _Metro_RadioIsChecked($RadioGroup, $Radio) 1981 | For $i = 0 To (UBound($GLOBAL_HOVER_REG) - 1) Step +1 1982 | If $GLOBAL_HOVER_REG[$i][0] = $Radio Then 1983 | If $GLOBAL_HOVER_REG[$i][4] = $RadioGroup Then 1984 | If $GLOBAL_HOVER_REG[$i][2] Then 1985 | Return True 1986 | Else 1987 | Return False 1988 | EndIf 1989 | EndIf 1990 | EndIf 1991 | Next 1992 | Return False 1993 | EndFunc ;==>_Metro_RadioIsChecked 1994 | 1995 | 1996 | #Region MetroCheckbox=========================================================================================== 1997 | ; #FUNCTION# ==================================================================================================================== 1998 | ; Name ..........: _Metro_CreateCheckbox 1999 | ; Description ...: Creates a metro style checkbox 2000 | ; Syntax ........: _Metro_CreateCheckbox($Text, $Left, $Top, $Width, $Height[, $BG_Color = $GUIThemeColor[, 2001 | ; $Font_Color = $FontThemeColor[, $Font = "Segoe UI"[, $FontSize = "11"[, $FontStyle = 0]]]]]) 2002 | ; Parameters ....: $Text - Text. 2003 | ; $Left - Left pos. 2004 | ; $Top - Top pos. 2005 | ; $Width - Width. 2006 | ; $Height - Height. 2007 | ; $BG_Color - [optional] Background color. Default is $GUIThemeColor. 2008 | ; $Font_Color - [optional] Font color. Default is $FontThemeColor. 2009 | ; $Font - [optional] Font. Default is "Segoe UI". 2010 | ; $FontSize - [optional] Fontsize. Default is "11". 2011 | ; $FontStyle - [optional] Fontstyle. Default is 0. 2012 | ; $cb_style - [optional] Creates a checkbox with the old design. You can also use _Metro_CreateCheckboxEx to do so. 2013 | ; Return values .: Handle to the Checkbox 2014 | ; =============================================================================================================================== 2015 | Func _Metro_CreateCheckbox($Text, $Left, $Top, $Width, $Height, $BG_Color = $GUIThemeColor, $Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "11", $FontStyle = 0, $cb_style = 1) 2016 | If $Height < 24 Then 2017 | If (@Compiled = 0) Then MsgBox(48, "Metro UDF", "The min. height is 24px for metro checkboxes.") 2018 | EndIf 2019 | 2020 | ;HighDPI Support 2021 | Local $chDPI = _HighDPICheck() 2022 | If $HIGHDPI_SUPPORT Then 2023 | $Left = Round($Left * $gDPI) 2024 | $Top = Round($Top * $gDPI) 2025 | $Width = Round($Width * $gDPI) 2026 | $Height = Round($Height * $gDPI) 2027 | If Not (Mod($Width, 2) = 0) Then $Width = $Width + 1 2028 | Else 2029 | $Fontsize = ($Fontsize / $Font_DPI_Ratio) 2030 | EndIf 2031 | 2032 | Local $Checkbox_Array[16] 2033 | $Checkbox_Array[1] = False ; Hover 2034 | $Checkbox_Array[2] = False ; Checkmark 2035 | $Checkbox_Array[3] = "5" ; Type 2036 | $Checkbox_Array[15] = GetCurrentGUI() 2037 | 2038 | ;Calc Box position etc. 2039 | Local $chbh = Round(22 * $chDPI) 2040 | Local $TopMargin = ($Height - $chbh) / 2 2041 | Local $CheckBox_Text_Margin = $chbh + ($TopMargin * 1.3) 2042 | Local $FrameSize 2043 | 2044 | If $cb_style = 0 Then 2045 | $FrameSize = $chbh / 7 2046 | Else 2047 | $FrameSize = $chbh / 8 2048 | EndIf 2049 | 2050 | Local $BoxFrameSize = 2 2051 | 2052 | ;Set Colors, Create Brushes and Pens 2053 | $BG_Color = "0xFF" & Hex($BG_Color, 6) 2054 | $Font_Color = "0xFF" & Hex($Font_Color, 6) 2055 | 2056 | Local $Brush_BTN_FontColor = _GDIPlus_BrushCreateSolid($Font_Color) 2057 | If $cb_style = 0 Then 2058 | Local $Brush1 = _GDIPlus_BrushCreateSolid(StringReplace($CB_Radio_Color, "0x", "0xFF")) ;default 2059 | Local $Brush3 = $Brush1 2060 | Local $Brush2 = _GDIPlus_BrushCreateSolid(StringReplace($CB_Radio_Hover_Color, "0x", "0xFF")) ;default hover 2061 | Local $Brush4 = $Brush2 ;checked hover 2062 | Local $PenX = _GDIPlus_PenCreate(StringReplace($CB_Radio_CheckMark_Color, "0x", "0xFF"), $FrameSize) ;CheckmarkColor 2063 | Else 2064 | Local $Brush1 = _GDIPlus_BrushCreateSolid(StringReplace($CB_Radio_Color, "0x", "0xFF")) ;default 2065 | Local $Brush2 = _GDIPlus_BrushCreateSolid(StringReplace($CB_Radio_Hover_Color, "0x", "0xFF")) ;default hover 2066 | Local $Brush3 = _GDIPlus_BrushCreateSolid(StringReplace($ButtonBKColor, "0x", "0xFF")) ;checked 2067 | Local $Brush4 = _GDIPlus_BrushCreateSolid(StringReplace(_AlterBrightness($ButtonBKColor, +10), "0x", "0xFF")) ;checked hover 2068 | Local $PenX = _GDIPlus_PenCreate(StringReplace($CB_Radio_Color, "0x", "0xFF"), $FrameSize) ;CheckmarkColor 2069 | EndIf 2070 | 2071 | ;Create graphics 2072 | Local $Checkbox_Graphic1 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5) ;default state 2073 | Local $Checkbox_Graphic2 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5) ;checked state 2074 | Local $Checkbox_Graphic3 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5) ;default hover state 2075 | Local $Checkbox_Graphic4 = _GDIPlusGraphic_Create($Width, $Height, $BG_Color, 5, 5) ;checked hover state 2076 | 2077 | ;Create font, Set font options 2078 | Local $hFormat = _GDIPlus_StringFormatCreate(), $hFamily = _GDIPlus_FontFamilyCreate($Font), $hFont = _GDIPlus_FontCreate($hFamily, $Fontsize, $FontStyle) 2079 | Local $tLayout = _GDIPlus_RectFCreate($CheckBox_Text_Margin, 0, $Width - $CheckBox_Text_Margin, $Height) 2080 | _GDIPlus_StringFormatSetAlign($hFormat, 1) 2081 | _GDIPlus_StringFormatSetLineAlign($hFormat, 1) 2082 | $tLayout.Y = 1 2083 | 2084 | ;Draw checkbox text 2085 | _GDIPlus_GraphicsDrawStringEx($Checkbox_Graphic1[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 2086 | _GDIPlus_GraphicsDrawStringEx($Checkbox_Graphic2[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 2087 | _GDIPlus_GraphicsDrawStringEx($Checkbox_Graphic3[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 2088 | _GDIPlus_GraphicsDrawStringEx($Checkbox_Graphic4[0], $Text, $hFont, $tLayout, $hFormat, $Brush_BTN_FontColor) 2089 | 2090 | ;Draw rounded box 2091 | Local $iRadius = Round(2 * $chDPI) 2092 | 2093 | Local $hPath = _GDIPlus_PathCreate() 2094 | _GDIPlus_PathAddArc($hPath, $chbh - ($iRadius * 2), $TopMargin, $iRadius * 2, $iRadius * 2, 270, 90) 2095 | _GDIPlus_PathAddArc($hPath, $chbh - ($iRadius * 2), $TopMargin + $chbh - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90) 2096 | _GDIPlus_PathAddArc($hPath, 0, $TopMargin + $chbh - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90) 2097 | _GDIPlus_PathAddArc($hPath, 0, $TopMargin, $iRadius * 2, $iRadius * 2, 180, 90) 2098 | _GDIPlus_PathCloseFigure($hPath) 2099 | 2100 | _GDIPlus_GraphicsFillPath($Checkbox_Graphic1[0], $hPath, $Brush1) ;Default state 2101 | _GDIPlus_GraphicsFillPath($Checkbox_Graphic3[0], $hPath, $Brush2) ;Default hover state 2102 | _GDIPlus_GraphicsFillPath($Checkbox_Graphic2[0], $hPath, $Brush3) ;Checked state 2103 | _GDIPlus_GraphicsFillPath($Checkbox_Graphic4[0], $hPath, $Brush4) ;Checked hover state 2104 | 2105 | 2106 | ;Calc size+pos 2107 | Local $Cutpoint = ($FrameSize * 0.70) / 2 2108 | Local $mpX = $chbh / 2.60 2109 | Local $mpY = $TopMargin + $chbh / 1.3 2110 | Local $apos1 = cAngle($mpX - $Cutpoint, $mpY, 135, $chbh / 1.35) 2111 | Local $apos2 = cAngle($mpX, $mpY - $Cutpoint, 225, $chbh / 3) 2112 | 2113 | 2114 | ;Add check mark 2115 | _GDIPlus_GraphicsDrawLine($Checkbox_Graphic2[0], $mpX - $Cutpoint, $mpY, $apos1[0], $apos1[1], $PenX) ;r 2116 | _GDIPlus_GraphicsDrawLine($Checkbox_Graphic2[0], $mpX, $mpY - $Cutpoint, $apos2[0], $apos2[1], $PenX) ;l 2117 | 2118 | _GDIPlus_GraphicsDrawLine($Checkbox_Graphic4[0], $mpX - $Cutpoint, $mpY, $apos1[0], $apos1[1], $PenX) 2119 | _GDIPlus_GraphicsDrawLine($Checkbox_Graphic4[0], $mpX, $mpY - $Cutpoint, $apos2[0], $apos2[1], $PenX) 2120 | 2121 | ;Release created objects 2122 | _GDIPlus_FontDispose($hFont) 2123 | _GDIPlus_FontFamilyDispose($hFamily) 2124 | _GDIPlus_StringFormatDispose($hFormat) 2125 | _GDIPlus_BrushDispose($Brush_BTN_FontColor) 2126 | _GDIPlus_BrushDispose($Brush1) 2127 | _GDIPlus_BrushDispose($Brush2) 2128 | _GDIPlus_BrushDispose($Brush3) 2129 | _GDIPlus_BrushDispose($Brush4) 2130 | _GDIPlus_PenDispose($PenX) 2131 | 2132 | ;Create bitmap handles and set graphics 2133 | $Checkbox_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height) 2134 | $Checkbox_Array[5] = _GDIPlusGraphic_CreateBitmapHandle($Checkbox_Array[0], $Checkbox_Graphic1) 2135 | $Checkbox_Array[7] = _GDIPlusGraphic_CreateBitmapHandle($Checkbox_Array[0], $Checkbox_Graphic2, False) 2136 | $Checkbox_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Checkbox_Array[0], $Checkbox_Graphic3, False) 2137 | $Checkbox_Array[8] = _GDIPlusGraphic_CreateBitmapHandle($Checkbox_Array[0], $Checkbox_Graphic4, False) 2138 | 2139 | ;For GUI Resizing 2140 | GUICtrlSetResizing($Checkbox_Array[0], 768) 2141 | 2142 | _Internal_AddHoverItem($Checkbox_Array) 2143 | 2144 | Return $Checkbox_Array[0] 2145 | EndFunc ;==>_Metro_CreateCheckbox 2146 | 2147 | ; #FUNCTION# ==================================================================================================================== 2148 | ; Name ..........: _Metro_CreateCheckboxEx 2149 | ; Description ...: Creates a checkbox with the old black and white style. 2150 | ; Syntax ........: _Metro_CreateCheckboxEx($Text, $Left, $Top, $Width, $Height[, $BG_Color = $GUIThemeColor[, $Font_Color = $FontThemeColor[, 2151 | ; $Font = "Segoe UI"[, $Fontsize = "11"[, $FontStyle = 0[, $cb_style = 1]]]]]]) 2152 | ; Parameters ....: $Text - Text. 2153 | ; $Left - Left pos. 2154 | ; $Top - Top pos. 2155 | ; $Width - Width. 2156 | ; $Height - Height. 2157 | ; $BG_Color - [optional] Background color. Default is $GUIThemeColor. 2158 | ; $Font_Color - [optional] Font color. Default is $FontThemeColor. 2159 | ; $Font - [optional] Font. Default is "Segoe UI". 2160 | ; $FontSize - [optional] Fontsize. Default is "11". 2161 | ; $FontStyle - [optional] Fontstyle. Default is 0. 2162 | ; Return values .: Handle to the Checkbox 2163 | ; =============================================================================================================================== 2164 | Func _Metro_CreateCheckboxEx($Text, $Left, $Top, $Width, $Height, $BG_Color = $GUIThemeColor, $Font_Color = $FontThemeColor, $Font = "Segoe UI", $Fontsize = "11", $FontStyle = 0) 2165 | Return _Metro_CreateCheckbox($Text, $Left, $Top, $Width, $Height, $BG_Color, $Font_Color, $Font, $Fontsize, $FontStyle, 0) 2166 | EndFunc ;==>_Metro_CreateCheckboxEx 2167 | 2168 | ; #FUNCTION# ==================================================================================================================== 2169 | ; Name ..........: _Metro_CheckboxIsChecked 2170 | ; Description ...: Checks if a metro checkbox is checked. 2171 | ; Syntax ........: _Metro_CheckboxIsChecked($Checkbox) 2172 | ; Parameters ....: $Checkbox - Handle to the checkbox. 2173 | ; Return values .: True / False 2174 | ; =============================================================================================================================== 2175 | Func _Metro_CheckboxIsChecked($Checkbox) 2176 | For $i = 0 To (UBound($GLOBAL_HOVER_REG) - 1) Step +1 2177 | If $GLOBAL_HOVER_REG[$i][0] = $Checkbox Then 2178 | If $GLOBAL_HOVER_REG[$i][2] Then 2179 | Return True 2180 | Else 2181 | Return False 2182 | EndIf 2183 | EndIf 2184 | Next 2185 | EndFunc ;==>_Metro_CheckboxIsChecked 2186 | 2187 | ; #FUNCTION# ==================================================================================================================== 2188 | ; Name ..........: _Metro_CheckboxUnCheck 2189 | ; Description ...: Unchecks a metro checkbox 2190 | ; Syntax ........: _Metro_CheckboxUnCheck($Checkbox) 2191 | ; Parameters ....: $Checkbox - Handle to the Checkbox. 2192 | ; =============================================================================================================================== 2193 | Func _Metro_CheckboxUnCheck($Checkbox) 2194 | For $i = 0 To (UBound($GLOBAL_HOVER_REG) - 1) Step +1 2195 | If $GLOBAL_HOVER_REG[$i][0] = $Checkbox Then 2196 | $GLOBAL_HOVER_REG[$i][2] = False 2197 | $GLOBAL_HOVER_REG[$i][1] = True 2198 | _WinAPI_DeleteObject(GUICtrlSendMsg($Checkbox, 0x0172, 0, $GLOBAL_HOVER_REG[$i][6])) 2199 | EndIf 2200 | Next 2201 | EndFunc ;==>_Metro_CheckboxUnCheck 2202 | 2203 | ; #FUNCTION# ==================================================================================================================== 2204 | ; Name ..........: _Metro_CheckboxCheck 2205 | ; Description ...: Checks a metro checkbox 2206 | ; Syntax ........: _Metro_CheckboxCheck($Checkbox) 2207 | ; Parameters ....: $Checkbox - Handle to the Checkbox. 2208 | ; =============================================================================================================================== 2209 | Func _Metro_CheckboxCheck($Checkbox) 2210 | For $i = 0 To (UBound($GLOBAL_HOVER_REG) - 1) Step +1 2211 | If $GLOBAL_HOVER_REG[$i][0] = $Checkbox Then 2212 | $GLOBAL_HOVER_REG[$i][2] = True 2213 | $GLOBAL_HOVER_REG[$i][1] = True 2214 | _WinAPI_DeleteObject(GUICtrlSendMsg($Checkbox, 0x0172, 0, $GLOBAL_HOVER_REG[$i][8])) 2215 | EndIf 2216 | Next 2217 | EndFunc ;==>_Metro_CheckboxCheck 2218 | #EndRegion MetroCheckbox=========================================================================================== 2219 | 2220 | #Region Metro MsgBox=========================================================================================== 2221 | ; #FUNCTION# ==================================================================================================================== 2222 | ; Name ..........: _Metro_MsgBox 2223 | ; Description ...: Creates a metro style MsgBox 2224 | ; Syntax ........: _Metro_MsgBox($Flag, $Title, $Text[, $mWidth = 600[, $FontSize = 14[, $ParentGUI = "", $Timeout = 0]]]) 2225 | ; Parameters ....: $Flag - Flag / Possible button combinations - See Autoit help file for possible buttons combinations under MsgBox 2226 | ; $Title - Title of the MsgBox. 2227 | ; $Text - Text of the MsgBox. 2228 | ; $mWidth - [optional] Width of the MsgBox. Use a value that matches the text length and font size. Default is 600. 2229 | ; $FontSize - [optional] Fontsize. Default is 11. 2230 | ; $ParentGUI - [optional] Parent GUI/Window to prevent multiple open windows in the taskbar for one program. Default is "". 2231 | ; $Timeout - [optional] Timeout in seconds. Default is 0. 2232 | ; 2233 | ; Notes .......: _GUIDisable($GUI, 0, 30) should be used before starting the MsgBox, so the MsgBox is better visible on top of your GUI. You also have to call _GUIDisable($GUI) afterwards. 2234 | ; =============================================================================================================================== 2235 | Func _Metro_MsgBox($Flag, $Title, $Text, $mWidth = 600, $Fontsize = 11, $ParentGUI = "", $Timeout = 0) 2236 | Local $1stButton, $2ndButton, $3rdButton, $1stButtonText = "-", $2ndButtonText = "-", $3rdButtonText = "-", $Buttons_Count = 1 2237 | Switch $Flag 2238 | Case 0 ;OK 2239 | $Buttons_Count = 1 2240 | $1stButtonText = "OK" 2241 | Case 1 ;OK / Cancel 2242 | $Buttons_Count = 2 2243 | $1stButtonText = "OK" 2244 | $2ndButtonText = "Cancel" 2245 | Case 2 ;Abort / Retry / Ignore 2246 | $Buttons_Count = 3 2247 | $1stButtonText = "Abort" 2248 | $2ndButtonText = "Retry" 2249 | $3rdButtonText = "Ignore" 2250 | Case 3 ;Yes / NO / Cancel 2251 | $Buttons_Count = 3 2252 | $1stButtonText = "Yes" 2253 | $2ndButtonText = "No" 2254 | $3rdButtonText = "Cancel" 2255 | Case 4 ;Yes / NO 2256 | $Buttons_Count = 2 2257 | $1stButtonText = "Yes" 2258 | $2ndButtonText = "No" 2259 | Case 5 ; Retry / Cancel 2260 | $Buttons_Count = 2 2261 | $1stButtonText = "Retry" 2262 | $2ndButtonText = "Cancel" 2263 | Case 6 ; Cancel / Retry / Continue 2264 | $Buttons_Count = 3 2265 | $1stButtonText = "Cancel" 2266 | $2ndButtonText = "Retry" 2267 | $3rdButtonText = "Continue" 2268 | Case Else 2269 | $Buttons_Count = 1 2270 | $1stButtonText = "OK" 2271 | EndSwitch 2272 | 2273 | If ($Buttons_Count = 1) And ($mWidth < 180) Then MsgBox(16, "MetroUDF", "Error: Messagebox width has to be at least 180px for the selected message style/flag.") 2274 | If ($Buttons_Count = 2) And ($mWidth < 240) Then MsgBox(16, "MetroUDF", "Error: Messagebox width has to be at least 240px for the selected message style/flag.") 2275 | If ($Buttons_Count = 3) And ($mWidth < 360) Then MsgBox(16, "MetroUDF", "Error: Messagebox width has to be at least 360px for the selected message style/flag.") 2276 | 2277 | ;HighDPI Support 2278 | Local $msgbDPI = _HighDPICheck() 2279 | If $HIGHDPI_SUPPORT Then 2280 | $mWidth = Round($mWidth * $gDPI) 2281 | Else 2282 | $Fontsize = ($Fontsize / $Font_DPI_Ratio) 2283 | EndIf 2284 | 2285 | 2286 | Local $LabelSize = _StringSize($Text, $Fontsize, 400, 0, "Arial", $mWidth - (30 * $msgbDPI)) 2287 | 2288 | Local $mHeight = 120 + ($LabelSize[3] / $msgbDPI) 2289 | Local $MsgBox_Form = _Metro_CreateGUI($Title, $mWidth / $msgbDPI, $mHeight, -1, -1, False, $ParentGUI) 2290 | $mHeight = $mHeight * $msgbDPI 2291 | GUICtrlCreateLabel(" " & $Title, 2 * $msgbDPI, 2 * $msgbDPI, $mWidth - (4 * $msgbDPI), 30 * $msgbDPI, 0x0200, 0x00100000) 2292 | GUICtrlSetBkColor(-1, _AlterBrightness($GUIThemeColor, 30)) 2293 | GUICtrlSetColor(-1, $FontThemeColor) 2294 | _GUICtrlSetFont(-1, 11, 600, 0, "Arial", 5) 2295 | GUICtrlCreateLabel($Text, 15 * $msgbDPI, 50 * $msgbDPI, $LabelSize[2], $LabelSize[3], -1, 0x00100000) 2296 | GUICtrlSetBkColor(-1, $GUIThemeColor) 2297 | GUICtrlSetColor(-1, $FontThemeColor) 2298 | GUICtrlSetFont(-1, $Fontsize, 400, 0, "Arial", 5) 2299 | 2300 | Local $1stButton_Left = (($mWidth / $msgbDPI) - ($Buttons_Count * 100) - (($Buttons_Count - 1) * 20)) / 2 2301 | Local $1stButton_Left1 = ($mWidth - ($Buttons_Count * (100 * $msgbDPI)) - (($Buttons_Count - 1) * (20 * $msgbDPI))) / 2 2302 | Local $2ndButton_Left = $1stButton_Left + 120 2303 | Local $3rdButton_Left = $2ndButton_Left + 120 2304 | 2305 | GUICtrlCreateLabel("", 2 * $msgbDPI, $mHeight - (53 * $msgbDPI), $1stButton_Left1 - (4 * $msgbDPI), (50 * $msgbDPI), -1, 0x00100000) 2306 | GUICtrlCreateLabel("", $mWidth - $1stButton_Left1 + (2 * $msgbDPI), $mHeight - (53 * $msgbDPI), $1stButton_Left1 - (4 * $msgbDPI), (50 * $msgbDPI), -1, 0x00100000) 2307 | 2308 | Local $1stButton = _Metro_CreateButton($1stButtonText, $1stButton_Left, ($mHeight / $msgbDPI) - 50, 100, 36, $ButtonBKColor, $ButtonTextColor) 2309 | Local $2ndButton = _Metro_CreateButton($2ndButtonText, $2ndButton_Left, ($mHeight / $msgbDPI) - 50, 100, 36, $ButtonBKColor, $ButtonTextColor) 2310 | If $Buttons_Count < 2 Then GUICtrlSetState($2ndButton, 32) 2311 | Local $3rdButton = _Metro_CreateButton($3rdButtonText, $3rdButton_Left, ($mHeight / $msgbDPI) - 50, 100, 36, $ButtonBKColor, $ButtonTextColor) 2312 | If $Buttons_Count < 3 Then GUICtrlSetState($3rdButton, 32) 2313 | GUISetState(@SW_SHOW) 2314 | 2315 | If Not ($Timeout = 0) Then 2316 | $Internal_MsgBoxTimeout = $Timeout 2317 | AdlibRegister("_Internal_MsgBoxTimeout", 1000) 2318 | EndIf 2319 | 2320 | While 1 2321 | _Metro_HoverCheck_Loop($MsgBox_Form) 2322 | If Not ($Timeout = 0) Then 2323 | If $Internal_MsgBoxTimeout <= 0 Then 2324 | AdlibUnRegister("_Internal_MsgBoxTimeout") 2325 | _Metro_GUIDelete($MsgBox_Form) 2326 | Return SetError(1) 2327 | EndIf 2328 | EndIf 2329 | Local $nMsg = GUIGetMsg() 2330 | Switch $nMsg 2331 | Case -3, $1stButton 2332 | _Metro_GUIDelete($MsgBox_Form) 2333 | Return $1stButtonText 2334 | Case $2ndButton 2335 | _Metro_GUIDelete($MsgBox_Form) 2336 | Return $2ndButtonText 2337 | Case $3rdButton 2338 | _Metro_GUIDelete($MsgBox_Form) 2339 | Return $3rdButtonText 2340 | EndSwitch 2341 | WEnd 2342 | 2343 | EndFunc ;==>_Metro_MsgBox 2344 | 2345 | #EndRegion Metro MsgBox=========================================================================================== 2346 | 2347 | #Region Metro Progressbar=========================================================================================== 2348 | ; #FUNCTION# ==================================================================================================================== 2349 | ; Name ..........: _Metro_CreateProgress 2350 | ; Description ...: Creates a simple progressbar. 2351 | ; Syntax ........: _Metro_CreateProgress($Left, $Top, $Width, $Height[, $EnableBorder = False[, $Backgroud_Color = $CB_Radio_Color[, 2352 | ; $Progress_Color = $ButtonBKColor]]]) 2353 | ; Parameters ....: $Left - Left pos. 2354 | ; $Top - Top pos. 2355 | ; $Width - Width. 2356 | ; $Height - Height. 2357 | ; $EnableBorder - [optional] Enables a 1px border from each side for the progressbar. Default is False. 2358 | ; $Backgroud_Color - [optional] Background color. Default is $CB_Radio_Color. 2359 | ; $Progress_Color - [optional] Progress color. Default is $ButtonBKColor. 2360 | ; Return values .: Array containing basic information about the progressbar that is required to set the % progress. 2361 | ; =============================================================================================================================== 2362 | Func _Metro_CreateProgress($Left, $Top, $Width, $Height, $EnableBorder = False, $Backgroud_Color = $CB_Radio_Color, $Progress_Color = $ButtonBKColor) 2363 | Local $Progress_Array[8] 2364 | 2365 | If $HIGHDPI_SUPPORT Then 2366 | $Left = Round($Left * $gDPI) 2367 | $Top = Round($Top * $gDPI) 2368 | $Width = Round($Width * $gDPI) 2369 | $Height = Round($Height * $gDPI) 2370 | EndIf 2371 | $Progress_Array[1] = $Width 2372 | $Progress_Array[2] = $Height 2373 | $Progress_Array[3] = "0xFF" & Hex($Backgroud_Color, 6) 2374 | $Progress_Array[4] = "0xFF" & Hex($Progress_Color, 6) 2375 | $Progress_Array[5] = StringReplace($CB_Radio_Hover_Color, "0x", "0xFF") 2376 | $Progress_Array[7] = $EnableBorder 2377 | 2378 | ;Set Colors 2379 | Local $ProgressBGPen = _GDIPlus_PenCreate($Progress_Array[5], 2) 2380 | 2381 | ;Create Graphics 2382 | Local $Progress_Graphic = _GDIPlusGraphic_Create($Width, $Height, $Progress_Array[3], 1, 5) 2383 | 2384 | ;Draw Progressbar border 2385 | If $EnableBorder Then 2386 | _GDIPlus_GraphicsDrawRect($Progress_Graphic[0], 0, 0, $Width, $Height, $ProgressBGPen) 2387 | EndIf 2388 | 2389 | ;Release created objects 2390 | _GDIPlus_PenDispose($ProgressBGPen) 2391 | 2392 | ;Create bitmap handles and set graphics 2393 | $Progress_Array[0] = GUICtrlCreatePic("", $Left, $Top, $Width, $Height) 2394 | $Progress_Array[6] = _GDIPlusGraphic_CreateBitmapHandle($Progress_Array[0], $Progress_Graphic) 2395 | 2396 | ;For GUI Resizing 2397 | GUICtrlSetResizing($Progress_Array[0], 768) 2398 | 2399 | Return $Progress_Array 2400 | EndFunc ;==>_Metro_CreateProgress 2401 | 2402 | ; #FUNCTION# ==================================================================================================================== 2403 | ; Name ..........: _Metro_SetProgress 2404 | ; Description ...: Sets the progress in % of a progressbar. 2405 | ; Syntax ........: _Metro_SetProgress(Byref $Progress, $Percent) 2406 | ; Parameters ....: $Progress - Array of the progressbar that has been returned by _Metro_CreateProgress function. 2407 | ; $Percent - A value from 0-100. (In %) 2408 | ; =============================================================================================================================== 2409 | Func _Metro_SetProgress(ByRef $Progress, $Percent) 2410 | ;Set Colors 2411 | Local $ProgressBGPen = _GDIPlus_PenCreate($Progress[5], 2) 2412 | Local $ProgressBGBrush = _GDIPlus_BrushCreateSolid($Progress[4]) 2413 | 2414 | ;Create Graphics 2415 | Local $Progress_Graphic = _GDIPlusGraphic_Create($Progress[1], $Progress[2], $Progress[3], 1, 5) 2416 | 2417 | ;Draw Progressbar 2418 | If $Percent > 100 Then $Percent = 100 2419 | If $Progress[7] Then 2420 | Local $ProgressWidth = (($Progress[1] - 2) / 100) * $Percent 2421 | _GDIPlus_GraphicsDrawRect($Progress_Graphic[0], 0, 0, $Progress[1], $Progress[2], $ProgressBGPen) 2422 | _GDIPlus_GraphicsFillRect($Progress_Graphic[0], 1, 1, $ProgressWidth, $Progress[2] - 2, $ProgressBGBrush) 2423 | Else 2424 | Local $ProgressWidth = (($Progress[1]) / 100) * $Percent 2425 | _GDIPlus_GraphicsFillRect($Progress_Graphic[0], 0, 0, $ProgressWidth, $Progress[2], $ProgressBGBrush) 2426 | EndIf 2427 | 2428 | ;Release created objects 2429 | _GDIPlus_PenDispose($ProgressBGPen) 2430 | _GDIPlus_BrushDispose($ProgressBGBrush) 2431 | 2432 | ;Create bitmap handles 2433 | Local $SetProgress = _GDIPlusGraphic_CreateBitmapHandle($Progress[0], $Progress_Graphic) 2434 | _WinAPI_DeleteObject($Progress[6]) 2435 | 2436 | $Progress[6] = $SetProgress 2437 | EndFunc ;==>_Metro_SetProgress 2438 | #EndRegion Metro Progressbar=========================================================================================== 2439 | 2440 | 2441 | #Region HoverEffects=========================================================================================== 2442 | ; #FUNCTION# ==================================================================================================================== 2443 | ; Name ..........: _Metro_HoverCheck_Loop 2444 | ; Description ...: Checks all created buttons, checkboxes etc for mouse hover. Required for the hover effects. This has to be added to the main while loop of the GUI. 2445 | ; Syntax ........: _Metro_HoverCheck_Loop($Metro_GUI[, $Metro_GUI_2 = 0]) 2446 | ; Parameters ....: 2447 | ; $Metro_GUI - The GUI to check for the mouse hover. 2448 | ; $Metro_GUI_2 - [optional] Prevents the main gui from losing focus(inactivity colors set) as long as the second provided gui is still active 2449 | ; =============================================================================================================================== 2450 | Func _Metro_HoverCheck_Loop($Metro_GUI, $Metro_GUI_2 = 0) 2451 | 2452 | Local $mHoverCheck = CheckGUIHover($Metro_GUI), $MInfo = GUIGetCursorInfo($Metro_GUI), $mWin_State = WinGetState($Metro_GUI) 2453 | For $i_BTN = 0 To (UBound($GLOBAL_HOVER_REG) - 1) 2454 | If $GLOBAL_HOVER_REG[$i_BTN][15] = $Metro_GUI Then 2455 | Switch $GLOBAL_HOVER_REG[$i_BTN][3] 2456 | Case "3" ;Swap Max/Restore buttons on state change 2457 | If Not (BitAND($mWin_State, 32) = 32) Then 2458 | If GUICtrlGetState($GLOBAL_HOVER_REG[$i_BTN][0]) = 96 Then GUICtrlSetState($GLOBAL_HOVER_REG[$i_BTN][0], 16) 2459 | Else 2460 | If GUICtrlGetState($GLOBAL_HOVER_REG[$i_BTN][0]) = 80 Then GUICtrlSetState($GLOBAL_HOVER_REG[$i_BTN][0], 32) 2461 | EndIf 2462 | Case "4" ;Swap Max/Restore buttons on state change 2463 | If BitAND($mWin_State, 32) = 32 Then 2464 | If GUICtrlGetState($GLOBAL_HOVER_REG[$i_BTN][0]) = 96 Then GUICtrlSetState($GLOBAL_HOVER_REG[$i_BTN][0], 16) 2465 | Else 2466 | If GUICtrlGetState($GLOBAL_HOVER_REG[$i_BTN][0]) = 80 Then GUICtrlSetState($GLOBAL_HOVER_REG[$i_BTN][0], 32) 2467 | EndIf 2468 | Case "5", "7" ;Check hover for checkboxes and radios 2469 | If $MInfo[4] = $GLOBAL_HOVER_REG[$i_BTN][0] And $mHoverCheck Then ;Enable hover 2470 | If (Not $GLOBAL_HOVER_REG[$i_BTN][1]) And Not (GUICtrlGetState($GLOBAL_HOVER_REG[$i_BTN][0]) = 144) Then 2471 | $GLOBAL_HOVER_REG[$i_BTN][1] = True 2472 | If $GLOBAL_HOVER_REG[$i_BTN][2] Then 2473 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][8])) ;Checked hover image 2474 | Else 2475 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][6])) ;Default hover image 2476 | EndIf 2477 | EndIf 2478 | Else ;Disable hover 2479 | If $GLOBAL_HOVER_REG[$i_BTN][1] Then 2480 | $GLOBAL_HOVER_REG[$i_BTN][1] = False 2481 | If $GLOBAL_HOVER_REG[$i_BTN][2] Then 2482 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][7])) ;Checked image 2483 | Else 2484 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][5])) ;Default image 2485 | EndIf 2486 | EndIf 2487 | EndIf 2488 | ContinueLoop 2489 | Case "6" ;Check hover for Toggles 2490 | If $MInfo[4] = $GLOBAL_HOVER_REG[$i_BTN][0] And $mHoverCheck Then 2491 | If (Not $GLOBAL_HOVER_REG[$i_BTN][1]) And Not (GUICtrlGetState($GLOBAL_HOVER_REG[$i_BTN][0]) = 144) Then 2492 | $GLOBAL_HOVER_REG[$i_BTN][1] = True 2493 | If $GLOBAL_HOVER_REG[$i_BTN][2] Then 2494 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][14])) ;Checked hover image 2495 | Else 2496 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][13])) ;Default hover image 2497 | EndIf 2498 | EndIf 2499 | Else ;Disable hover Toggles 2500 | If $GLOBAL_HOVER_REG[$i_BTN][1] Then 2501 | $GLOBAL_HOVER_REG[$i_BTN][1] = False 2502 | If $GLOBAL_HOVER_REG[$i_BTN][2] Then 2503 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][12])) ;Checked image 2504 | Else 2505 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][5])) ;Default image 2506 | EndIf 2507 | EndIf 2508 | EndIf 2509 | ContinueLoop 2510 | EndSwitch 2511 | 2512 | ;Enable Hover for Buttons 2513 | If $MInfo[4] = $GLOBAL_HOVER_REG[$i_BTN][0] And $mHoverCheck Then ;If mouseover 2514 | If (Not $GLOBAL_HOVER_REG[$i_BTN][1]) And Not (GUICtrlGetState($GLOBAL_HOVER_REG[$i_BTN][0]) = 144) Then ;if not hover on allready and button enabled 2515 | $GLOBAL_HOVER_REG[$i_BTN][1] = True 2516 | $GLOBAL_HOVER_REG[$i_BTN][2] = False 2517 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][6])) ;Button hover image 2518 | EndIf 2519 | GUISetCursor(2, 1) 2520 | ContinueLoop 2521 | EndIf 2522 | ;Disable hover for Buttons 2523 | If $GLOBAL_HOVER_REG[$i_BTN][1] Then 2524 | If $GLOBAL_HOVER_REG[$i_BTN][3] = "8" Then 2525 | If Not (GUICtrlGetState($GLOBAL_HOVER_REG[$i_BTN][0]) = 144) Then 2526 | $GLOBAL_HOVER_REG[$i_BTN][1] = False 2527 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][5])) ;Button default image 2528 | EndIf 2529 | Else 2530 | $GLOBAL_HOVER_REG[$i_BTN][1] = False 2531 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][5])) ;Button default image 2532 | EndIf 2533 | EndIf 2534 | 2535 | ;Set Active/Inactive color for control buttons 2536 | Switch $GLOBAL_HOVER_REG[$i_BTN][3] 2537 | Case 0, 3, 4, 8 2538 | If WinActive($Metro_GUI) Or WinActive($Metro_GUI_2) Then 2539 | If $GLOBAL_HOVER_REG[$i_BTN][2] Then 2540 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][5])) ;Button default image 2541 | $GLOBAL_HOVER_REG[$i_BTN][2] = False 2542 | EndIf 2543 | Else 2544 | If Not $GLOBAL_HOVER_REG[$i_BTN][2] Then 2545 | _WinAPI_DeleteObject(GUICtrlSendMsg($GLOBAL_HOVER_REG[$i_BTN][0], 0x0172, 0, $GLOBAL_HOVER_REG[$i_BTN][7])) 2546 | $GLOBAL_HOVER_REG[$i_BTN][2] = True 2547 | EndIf 2548 | EndIf 2549 | EndSwitch 2550 | EndIf 2551 | Next 2552 | 2553 | EndFunc ;==>_Metro_HoverCheck_Loop 2554 | 2555 | Func _Internal_AddHoverItem($Button_ADD) 2556 | Local $GLOBAL_HRSize = UBound($GLOBAL_HOVER_REG) 2557 | ReDim $GLOBAL_HOVER_REG[$GLOBAL_HRSize + 1][16] 2558 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][0] = $Button_ADD[0] 2559 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][1] = $Button_ADD[1] 2560 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][2] = $Button_ADD[2] 2561 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][3] = $Button_ADD[3] 2562 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][4] = $Button_ADD[4] 2563 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][5] = $Button_ADD[5] 2564 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][6] = $Button_ADD[6] 2565 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][7] = $Button_ADD[7] 2566 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][8] = $Button_ADD[8] 2567 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][9] = $Button_ADD[9] 2568 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][10] = $Button_ADD[10] 2569 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][11] = $Button_ADD[11] 2570 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][12] = $Button_ADD[12] 2571 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][13] = $Button_ADD[13] 2572 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][14] = $Button_ADD[14] 2573 | $GLOBAL_HOVER_REG[$GLOBAL_HRSize][15] = $Button_ADD[15] 2574 | EndFunc ;==>_Internal_AddHoverItem 2575 | 2576 | Func _Internal_GUIRemoveHover($mGUI) 2577 | Local $Cleaned_Hover_REG[0] 2578 | For $i_HR = 0 To UBound($GLOBAL_HOVER_REG) - 1 Step +1 2579 | If Not ($GLOBAL_HOVER_REG[$i_HR][15] = $mGUI) Then 2580 | ReDim $Cleaned_Hover_REG[UBound($Cleaned_Hover_REG) + 1][16] 2581 | For $i_Hx = 0 To 15 Step +1 2582 | $Cleaned_Hover_REG[UBound($Cleaned_Hover_REG) - 1][$i_Hx] = $GLOBAL_HOVER_REG[$i_HR][$i_Hx] 2583 | Next 2584 | EndIf 2585 | Next 2586 | $GLOBAL_HOVER_REG = $Cleaned_Hover_REG 2587 | EndFunc ;==>_Internal_GUIRemoveHover 2588 | 2589 | #EndRegion HoverEffects=========================================================================================== 2590 | 2591 | #Region Required_Funcs=========================================================================================== 2592 | Func _GDIPlusGraphic_Create($hWidth, $hHeight, $BackgroundColor = 0, $Smoothingmode = 4, $TextCleartype = 0) 2593 | Local $Picture_Array[2] 2594 | $Picture_Array[1] = _GDIPlus_BitmapCreateFromScan0($hWidth, $hHeight) 2595 | $Picture_Array[0] = _GDIPlus_ImageGetGraphicsContext($Picture_Array[1]) 2596 | _GDIPlus_GraphicsSetSmoothingMode($Picture_Array[0], $Smoothingmode) 2597 | _GDIPlus_GraphicsSetTextRenderingHint($Picture_Array[0], $TextCleartype) 2598 | If Not ($BackgroundColor = 0) Then _GDIPlus_GraphicsClear($Picture_Array[0], $BackgroundColor) 2599 | Return $Picture_Array 2600 | EndFunc ;==>_GDIPlusGraphic_Create 2601 | 2602 | 2603 | Func _GDIPlusGraphic_CreateBitmapHandle($hPicture, $Picture_Array, $hVisible = True) 2604 | Local $cBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($Picture_Array[1]) 2605 | If $hVisible = True Then _WinAPI_DeleteObject(GUICtrlSendMsg($hPicture, 0x0172, 0, $cBitmap)) 2606 | _GDIPlus_GraphicsDispose($Picture_Array[0]) 2607 | _GDIPlus_BitmapDispose($Picture_Array[1]) 2608 | Return $cBitmap 2609 | EndFunc ;==>_GDIPlusGraphic_CreateBitmapHandle 2610 | 2611 | Func GetCurrentGUI() ;Thanks @binhnx 2612 | Local $idCtrlDummy = GUICtrlCreateLabel("", 0, 0, 0, 0) 2613 | Local $hWndCurrent = _WinAPI_GetParent(GUICtrlGetHandle($idCtrlDummy)) 2614 | GUICtrlDelete($idCtrlDummy) 2615 | Return $hWndCurrent 2616 | EndFunc ;==>GetCurrentGUI 2617 | Func _HighDPICheck() 2618 | If $HIGHDPI_SUPPORT Then 2619 | Return $gDPI 2620 | Else 2621 | Return "1" 2622 | EndIf 2623 | EndFunc ;==>_HighDPICheck 2624 | 2625 | Func cAngle($x1, $y1, $Ang, $Length) 2626 | Local $Return[2] 2627 | $Return[0] = $x1 + ($Length * Sin($Ang / 180 * 3.14159265358979)) 2628 | $Return[1] = $y1 + ($Length * Cos($Ang / 180 * 3.14159265358979)) 2629 | Return $Return 2630 | EndFunc ;==>cAngle 2631 | 2632 | Func _GUICtrlSetFont($icontrolID, $iSize, $iweight = 400, $iattribute = 0, $sfontname = "", $iquality = 5) 2633 | If $HIGHDPI_SUPPORT = True Then 2634 | GUICtrlSetFont($icontrolID, $iSize, $iweight, $iattribute, $sfontname, $iquality) 2635 | Else 2636 | GUICtrlSetFont($icontrolID, $iSize / $Font_DPI_Ratio, $iweight, $iattribute, $sfontname, $iquality) 2637 | EndIf 2638 | EndFunc ;==>_GUICtrlSetFont 2639 | 2640 | Func _SetFont_GetDPI() 2641 | Local $a1[3] 2642 | Local $iDPI, $iDPIRat, $Logpixelsy = 90, $hWnd = 0 2643 | Local $hDC = DllCall("user32.dll", "long", "GetDC", "long", $hWnd) 2644 | Local $aRet = DllCall("gdi32.dll", "long", "GetDeviceCaps", "long", $hDC[0], "long", $Logpixelsy) 2645 | $hDC = DllCall("user32.dll", "long", "ReleaseDC", "long", $hWnd, "long", $hDC) 2646 | $iDPI = $aRet[0] 2647 | Select 2648 | Case $iDPI = 0 2649 | $iDPI = 96 2650 | $iDPIRat = 94 2651 | Case $iDPI < 84 2652 | $iDPIRat = $iDPI / 105 2653 | Case $iDPI < 121 2654 | $iDPIRat = $iDPI / 96 2655 | Case $iDPI < 145 2656 | $iDPIRat = $iDPI / 95 2657 | Case Else 2658 | $iDPIRat = $iDPI / 94 2659 | EndSelect 2660 | $a1[0] = 2 2661 | $a1[1] = $iDPI 2662 | $a1[2] = $iDPIRat 2663 | Return $a1 2664 | EndFunc ;==>_SetFont_GetDPI 2665 | 2666 | Func CheckGUIHover($mGUIh) 2667 | If WinActive($mGUIh) Then Return True 2668 | Local Static $g_tStruct = DllStructCreate($tagPOINT) 2669 | DllStructSetData($g_tStruct, "x", MouseGetPos(0)) 2670 | DllStructSetData($g_tStruct, "y", MouseGetPos(1)) 2671 | If _WinAPI_GetAncestor(_WinAPI_WindowFromPoint($g_tStruct), $GA_ROOT) = $mGUIh Then 2672 | Return True 2673 | Else 2674 | Return False 2675 | EndIf 2676 | EndFunc ;==>CheckGUIHover 2677 | 2678 | Func _Internal_MsgBoxTimeout() 2679 | $Internal_MsgBoxTimeout -= 1 2680 | EndFunc ;==>_Internal_MsgBoxTimeout 2681 | 2682 | Func _ReduceMemory($i_PID = -1) 2683 | Local $ai_Return 2684 | If $i_PID <> -1 Then 2685 | Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID) 2686 | $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) 2687 | DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) 2688 | Else 2689 | $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) 2690 | EndIf 2691 | Return $ai_Return[0] 2692 | EndFunc ;==>_ReduceMemory 2693 | 2694 | Func _AlterBrightness($StartCol, $adjust, $Select = 7) 2695 | Local $red = $adjust * (BitAND(1, $Select) <> 0) + BitAND($StartCol, 0xff0000) / 0x10000 2696 | Local $grn = $adjust * (BitAND(2, $Select) <> 0) + BitAND($StartCol, 0x00ff00) / 0x100 2697 | Local $blu = $adjust * (BitAND(4, $Select) <> 0) + BitAND($StartCol, 0x0000FF) 2698 | Return "0x" & Hex(String(limitCol($red) * 0x10000 + limitCol($grn) * 0x100 + limitCol($blu)), 6) 2699 | EndFunc ;==>_AlterBrightness 2700 | Func limitCol($cc) 2701 | If $cc > 255 Then Return 255 2702 | If $cc < 0 Then Return 0 2703 | Return $cc 2704 | EndFunc ;==>limitCol 2705 | 2706 | Func _CreateBorder($guiW, $guiH, $bordercolor = 0xFFFFFF, $style = 1, $borderThickness = 1) 2707 | If $style = 0 Then 2708 | ;#TOP# 2709 | GUICtrlCreateLabel("", 0, 0, $guiW, $borderThickness) 2710 | GUICtrlSetColor(-1, $bordercolor) 2711 | GUICtrlSetBkColor(-1, $bordercolor) 2712 | GUICtrlSetResizing(-1, 544) 2713 | GUICtrlSetState(-1, 128) 2714 | ;#Bottom 2715 | GUICtrlCreateLabel("", 0, $guiH - $borderThickness, $guiW, $borderThickness) 2716 | GUICtrlSetColor(-1, $bordercolor) 2717 | GUICtrlSetBkColor(-1, $bordercolor) 2718 | GUICtrlSetResizing(-1, 576) 2719 | GUICtrlSetState(-1, 128) 2720 | ;#Left 2721 | GUICtrlCreateLabel("", 0, 1, $borderThickness, $guiH - 1) 2722 | GUICtrlSetColor(-1, $bordercolor) 2723 | GUICtrlSetBkColor(-1, $bordercolor) 2724 | GUICtrlSetResizing(-1, 256 + 2) 2725 | GUICtrlSetState(-1, 128) 2726 | ;#Right 2727 | GUICtrlCreateLabel("", $guiW - $borderThickness, 1, $borderThickness, $guiH - 1) 2728 | GUICtrlSetColor(-1, $bordercolor) 2729 | GUICtrlSetBkColor(-1, $bordercolor) 2730 | GUICtrlSetResizing(-1, 256 + 4) 2731 | GUICtrlSetState(-1, 128) 2732 | Else 2733 | ;#TOP# 2734 | GUICtrlCreateLabel("", 1, 1, $guiW - 2, $borderThickness) 2735 | GUICtrlSetColor(-1, $bordercolor) 2736 | GUICtrlSetBkColor(-1, $bordercolor) 2737 | GUICtrlSetResizing(-1, 544) 2738 | GUICtrlSetState(-1, 128) 2739 | ;#Bottom 2740 | GUICtrlCreateLabel("", 1, $guiH - $borderThickness - 1, $guiW - 2, $borderThickness) 2741 | GUICtrlSetColor(-1, $bordercolor) 2742 | GUICtrlSetBkColor(-1, $bordercolor) 2743 | GUICtrlSetResizing(-1, 576) 2744 | GUICtrlSetState(-1, 128) 2745 | ;#Left 2746 | GUICtrlCreateLabel("", 1, 1, $borderThickness, $guiH - 2) 2747 | GUICtrlSetColor(-1, $bordercolor) 2748 | GUICtrlSetBkColor(-1, $bordercolor) 2749 | GUICtrlSetResizing(-1, 256 + 2) 2750 | GUICtrlSetState(-1, 128) 2751 | ;#Right 2752 | GUICtrlCreateLabel("", $guiW - $borderThickness - 1, 1, $borderThickness, $guiH - 2) 2753 | GUICtrlSetColor(-1, $bordercolor) 2754 | GUICtrlSetBkColor(-1, $bordercolor) 2755 | GUICtrlSetResizing(-1, 256 + 4) 2756 | GUICtrlSetState(-1, 128) 2757 | EndIf 2758 | EndFunc ;==>_CreateBorder 2759 | 2760 | Func _WinPos($ParentWin, $Win_Wi, $Win_Hi) 2761 | Local $Win_SetPos[2] 2762 | $Win_SetPos[0] = "-1" 2763 | $Win_SetPos[1] = "-1" 2764 | Local $Win_POS = WinGetPos($ParentWin) 2765 | If Not @error Then 2766 | $Win_SetPos[0] = ($Win_POS[0] + (($Win_POS[2] - $Win_Wi) / 2)) 2767 | $Win_SetPos[1] = ($Win_POS[1] + (($Win_POS[3] - $Win_Hi) / 2)) 2768 | EndIf 2769 | Return $Win_SetPos 2770 | EndFunc ;==>_WinPos 2771 | 2772 | 2773 | ; #FUNCTION# ==================================================================================================================== 2774 | ; Name ..........: _GDIPlus_GraphicsGetDPIRatio 2775 | ; Description ...: 2776 | ; Syntax ........: _GDIPlus_GraphicsGetDPIRatio([$iDPIDef = 96]) 2777 | ; Parameters ....: $iDPIDef - [optional] An integer value. Default is 96. 2778 | ; Return values .: None 2779 | ; Author ........: UEZ 2780 | ; Link ..........: http://www.autoitscript.com/forum/topic/159612-dpi-resolution-problem/?hl=%2Bdpi#entry1158317 2781 | ; Example .......: No 2782 | ; =============================================================================================================================== 2783 | Func _GDIPlus_GraphicsGetDPIRatio($iDPIDef = 96) 2784 | _GDIPlus_Startup() 2785 | Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0) 2786 | If @error Then Return SetError(1, @extended, 0) 2787 | Local $aResult 2788 | #forcedef $__g_hGDIPDll, $ghGDIPDll 2789 | 2790 | $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0) 2791 | 2792 | If @error Then Return SetError(2, @extended, 0) 2793 | Local $iDPI = $aResult[2] 2794 | _GDIPlus_GraphicsDispose($hGfx) 2795 | _GDIPlus_Shutdown() 2796 | Return $iDPI / $iDPIDef 2797 | EndFunc ;==>_GDIPlus_GraphicsGetDPIRatio 2798 | #EndRegion Required_Funcs=========================================================================================== 2799 | 2800 | 2801 | -------------------------------------------------------------------------------- /Lib/MetroGUI-UDF/MetroThemes.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | #cs ---------------------------------------------------------------------------- 3 | Author: BB_19 4 | Material Themes for MetroGUI UDF 5 | #ce ---------------------------------------------------------------------------- 6 | 7 | ;#Set Default Theme 8 | Global $GUIThemeColor = "0x191919" ; GUI Background Color 9 | Global $FontThemeColor = "0xFFFFFF" ; Font Color 10 | Global $GUIBorderColor = "0x303030" ; GUI Border Color 11 | Global $ButtonBKColor = "0x40798D" ; Metro Button BacKground Color 12 | Global $ButtonTextColor = "0xFFFFFF" ; Metro Button Text Color 13 | Global $GUI_Theme_Name = "DarkBlue" 14 | Global $ControlThickStyle = False ; Enables thick "Close/Maximize/Minimiz" button style. 15 | Global $CB_Radio_Color = "0xFFFFFF" ;Checkbox and Radio Color (Box/Circle) 16 | Global $CB_Radio_Hover_Color = "0xD8D8D8"; Checkbox and Radio Hover Color (Box/Circle) 17 | Global $CB_Radio_CheckMark_Color = "0x1B1B1B"; Checkbox and Radio checkmark color 18 | 19 | 20 | Func _SetTheme($ThemeSelect = "DarkTeal") 21 | Switch ($ThemeSelect) 22 | Case "LightTeal" 23 | $GUIThemeColor = "0xcccccc" 24 | $FontThemeColor = "0x1B1B1B" 25 | $GUIBorderColor = "0xD8D8D8" 26 | $ButtonBKColor = "0x009688" 27 | $ButtonTextColor = "0xFFFFFF" 28 | $GUI_Theme_Name = "LightTeal" 29 | $ControlThickStyle = False 30 | $CB_Radio_Color = "0xFFFFFF" 31 | $CB_Radio_Hover_Color = "0xF7F7F7" 32 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 33 | Case "DarkTeal" 34 | $GUIThemeColor = "0x212121" 35 | $FontThemeColor = "0xFFFFFF" 36 | $GUIBorderColor = "0x2D2D2D" 37 | $ButtonBKColor = "0x00897b" 38 | $ButtonTextColor = "0xFFFFFF" 39 | $GUI_Theme_Name = "DarkTeal" 40 | $ControlThickStyle = False 41 | $CB_Radio_Color = "0xFFFFFF" 42 | $CB_Radio_Hover_Color = "0xD8D8D8" 43 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 44 | Case "DarkMidnight" 45 | $GUIThemeColor = "0x1F253D" 46 | $FontThemeColor = "0xFFFFFF" 47 | $GUIBorderColor = "0x242B47" 48 | $ButtonBKColor = "0x3C4D66" 49 | $ButtonTextColor = "0xFFFFFF" 50 | $GUI_Theme_Name = "DarkMidnightV2" 51 | $ControlThickStyle = False 52 | $CB_Radio_Color = "0xFFFFFF" 53 | $CB_Radio_Hover_Color = "0xD8D8D8" 54 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 55 | Case "DarkBlue" 56 | $GUIThemeColor = "0x212121" 57 | $FontThemeColor = "0xFFFFFF" 58 | $GUIBorderColor = "0x303030" 59 | $ButtonBKColor = "0x40798D" 60 | $ButtonTextColor = "0xFFFFFF" 61 | $GUI_Theme_Name = "DarkBlue" 62 | $ControlThickStyle = False 63 | $CB_Radio_Color = "0xFFFFFF" 64 | $CB_Radio_Hover_Color = "0xD8D8D8" 65 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 66 | Case "LightBlue" 67 | $GUIThemeColor = "0xcccccc" 68 | $FontThemeColor = "0x1B1B1B" 69 | $GUIBorderColor = "0xD8D8D8" 70 | $ButtonBKColor = "0x0d47a1" 71 | $ButtonTextColor = "0xFFFFFF" 72 | $GUI_Theme_Name = "LightBlue" 73 | $ControlThickStyle = False 74 | $CB_Radio_Color = "0xFFFFFF" 75 | $CB_Radio_Hover_Color = "0xF7F7F7" 76 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 77 | Case "DarkBlueV2" 78 | $GUIThemeColor = "0x282828" 79 | $FontThemeColor = "0xFFFFFF" 80 | $GUIBorderColor = "0x2D2D2D" 81 | $ButtonBKColor = "0x0d47a1" 82 | $ButtonTextColor = "0xFFFFFF" 83 | $GUI_Theme_Name = "DarkBlue" 84 | $ControlThickStyle = False 85 | $CB_Radio_Color = "0xFFFFFF" 86 | $CB_Radio_Hover_Color = "0xD8D8D8" 87 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 88 | Case "LightCyan" 89 | $GUIThemeColor = "0xD7D7D7" 90 | $FontThemeColor = "0x1B1B1B" 91 | $GUIBorderColor = "0xD8D8D8" 92 | $ButtonBKColor = "0x00838f" 93 | $ButtonTextColor = "0xFFFFFF" 94 | $GUI_Theme_Name = "LightCyan" 95 | $ControlThickStyle = False 96 | $CB_Radio_Color = "0xFFFFFF" 97 | $CB_Radio_Hover_Color = "0xF7F7F7" 98 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 99 | Case "DarkCyan" 100 | $GUIThemeColor = "0x212121" 101 | $FontThemeColor = "0xFFFFFF" 102 | $GUIBorderColor = "0x2D2D2D" 103 | $ButtonBKColor = "0x00838f" 104 | $ButtonTextColor = "0xFFFFFF" 105 | $GUI_Theme_Name = "DarkCyan" 106 | $ControlThickStyle = False 107 | $CB_Radio_Color = "0xFFFFFF" 108 | $CB_Radio_Hover_Color = "0xD8D8D8" 109 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 110 | Case "LightGray" 111 | $GUIThemeColor = "0xcccccc" 112 | $FontThemeColor = "0x1B1B1B" 113 | $GUIBorderColor = "0xD8D8D8" 114 | $ButtonBKColor = "0x3F5863" 115 | $ButtonTextColor = "0xFFFFFF" 116 | $GUI_Theme_Name = "LightGray" 117 | $ControlThickStyle = False 118 | $CB_Radio_Color = "0xFFFFFF" 119 | $CB_Radio_Hover_Color = "0xF7F7F7" 120 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 121 | Case "LightGreen" 122 | $GUIThemeColor = "0xD7D7D7" 123 | $FontThemeColor = "0x212121" 124 | $GUIBorderColor = "0xD8D8D8" 125 | $ButtonBKColor = "0x2E7D32" 126 | $ButtonTextColor = "0xFFFFFF" 127 | $GUI_Theme_Name = "LightGreen" 128 | $ControlThickStyle = False 129 | $CB_Radio_Color = "0xFFFFFF" 130 | $CB_Radio_Hover_Color = "0xF7F7F7" 131 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 132 | Case "DarkGreen" 133 | $GUIThemeColor = "0x212121" 134 | $FontThemeColor = "0xFFFFFF" 135 | $GUIBorderColor = "0x2D2D2D" 136 | $ButtonBKColor = "0x179141" 137 | $ButtonTextColor = "0xFFFFFF" 138 | $GUI_Theme_Name = "DarkGreen" 139 | $ControlThickStyle = False 140 | $CB_Radio_Color = "0xFFFFFF" 141 | $CB_Radio_Hover_Color = "0xD8D8D8" 142 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 143 | Case "LightRed" 144 | $GUIThemeColor = "0xD7D7D7" 145 | $FontThemeColor = "0x212121" 146 | $GUIBorderColor = "0xD8D8D8" 147 | $ButtonBKColor = "0xc62828" 148 | $ButtonTextColor = "0xFFFFFF" 149 | $GUI_Theme_Name = "LightRed" 150 | $ControlThickStyle = False 151 | $CB_Radio_Color = "0xFFFFFF" 152 | $CB_Radio_Hover_Color = "0xF7F7F7" 153 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 154 | Case "DarkGray" 155 | $GUIThemeColor = "0x455A64" 156 | $FontThemeColor = "0xFFFFFF" 157 | $GUIBorderColor = "0x4F6772" 158 | $ButtonBKColor = "0x607D8B" 159 | $ButtonTextColor = "0xFFFFFF" 160 | $GUI_Theme_Name = "DarkGray" 161 | $ControlThickStyle = False 162 | $CB_Radio_Color = "0xFFFFFF" 163 | $CB_Radio_Hover_Color = "0xD8D8D8" 164 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 165 | Case "DarkAmber" 166 | $GUIThemeColor = "0x212121" 167 | $FontThemeColor = "0xFFFFFF" 168 | $GUIBorderColor = "0x2D2D2D" 169 | $ButtonBKColor = "0xffa000" 170 | $ButtonTextColor = "0xFFFFFF" 171 | $GUI_Theme_Name = "DarkAmber" 172 | $ControlThickStyle = False 173 | $CB_Radio_Color = "0xFFFFFF" 174 | $CB_Radio_Hover_Color = "0xD8D8D8" 175 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 176 | Case "LightOrange" 177 | $GUIThemeColor = "0xD7D7D7" 178 | $FontThemeColor = "0x212121" 179 | $GUIBorderColor = "0xD8D8D8" 180 | $ButtonBKColor = "0xd84315" 181 | $ButtonTextColor = "0xFFFFFF" 182 | $GUI_Theme_Name = "LightOrange" 183 | $ControlThickStyle = False 184 | $CB_Radio_Color = "0xFFFFFF" 185 | $CB_Radio_Hover_Color = "0xF7F7F7" 186 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 187 | Case "DarkOrange" 188 | $GUIThemeColor = "0x212121" 189 | $FontThemeColor = "0xFFFFFF" 190 | $GUIBorderColor = "0x2D2D2D" 191 | $ButtonBKColor = "0xf4511e" 192 | $ButtonTextColor = "0xFFFFFF" 193 | $GUI_Theme_Name = "DarkOrange" 194 | $ControlThickStyle = False 195 | $CB_Radio_Color = "0xFFFFFF" 196 | $CB_Radio_Hover_Color = "0xD8D8D8" 197 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 198 | Case "LightPurple" 199 | $GUIThemeColor = "0xD7D7D7" 200 | $FontThemeColor = "0x212121" 201 | $GUIBorderColor = "0xD8D8D8" 202 | $ButtonBKColor = "0x512DA8" 203 | $ButtonTextColor = "0xFFFFFF" 204 | $GUI_Theme_Name = "LightPurple" 205 | $ControlThickStyle = False 206 | $CB_Radio_Color = "0xFFFFFF" 207 | $CB_Radio_Hover_Color = "0xF7F7F7" 208 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 209 | Case "DarkPurple" 210 | $GUIThemeColor = "0x212121" 211 | $FontThemeColor = "0xFFFFFF" 212 | $GUIBorderColor = "0x2D2D2D" 213 | $ButtonBKColor = "0x512DA8" 214 | $ButtonTextColor = "0xFFFFFF" 215 | $GUI_Theme_Name = "DarkPurple" 216 | $ControlThickStyle = False 217 | $CB_Radio_Color = "0xFFFFFF" 218 | $CB_Radio_Hover_Color = "0xD8D8D8" 219 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 220 | Case "LightPink" 221 | $GUIThemeColor = "0xD7D7D7" 222 | $FontThemeColor = "0x212121" 223 | $GUIBorderColor = "0xD8D8D8" 224 | $ButtonBKColor = "0xE91E63" 225 | $ButtonTextColor = "0xFFFFFF" 226 | $GUI_Theme_Name = "LightPink" 227 | $ControlThickStyle = False 228 | $CB_Radio_Color = "0xFFFFFF" 229 | $CB_Radio_Hover_Color = "0xF7F7F7" 230 | $CB_Radio_CheckMark_Color = "0x1B1B1B" 231 | 232 | 233 | EndSwitch 234 | EndFunc ;==>_SetTheme 235 | -------------------------------------------------------------------------------- /Lib/MetroGUI-UDF/MetroUDF-Required/BorderLessWinUDF.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | #include 3 | 4 | Global $GLOBAL_GUI_LIST[0], $gDPI 5 | 6 | ;Prevent Borders/Frame from drawing 7 | Func INTERNAL_INTERCEPT_FRAMEDRAW($hWnd, $iMsg, $wParam, $lParam) 8 | _Int_GetGUIID($hWnd) 9 | If @error Then Return 'GUI_RUNDEFMSG' 10 | Return -1 11 | EndFunc ;==>INTERNAL_INTERCEPT_FRAMEDRAW 12 | 13 | ;Fix maximized position 14 | Func INTERNAL_WM_SIZING($hWnd, $iMsg, $wParam, $lParam) 15 | Local $iGui_Count = _Int_GetGUIID($hWnd) 16 | If @error Then Return 'GUI_RUNDEFMSG' 17 | If $GLOBAL_GUI_LIST[$iGui_Count][2] Then 18 | If (WinGetState($hWnd) = 47) Then 19 | Local $WrkSize = _GetDesktopWorkArea($hWnd) 20 | Local $aWinPos = WinGetPos($hWnd) 21 | WinMove($hWnd, "", $aWinPos[0] - 1, $aWinPos[1] - 1, $WrkSize[2], $WrkSize[3]) 22 | EndIf 23 | EndIf 24 | Return 'GUI_RUNDEFMSG' 25 | EndFunc ;==>INTERNAL_WM_SIZING 26 | 27 | ; Set min and max GUI sizes 28 | Func INTERNAL_WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam) 29 | Local $iGui_Count = _Int_GetGUIID($hWnd) 30 | If @error Then Return 'GUI_RUNDEFMSG' 31 | 32 | If $GLOBAL_GUI_LIST[$iGui_Count][2] Then 33 | Local $tMinMax = DllStructCreate("int;int;int;int;int;int;int;int;int;dword", $lParam) 34 | Local $WrkSize = _GetDesktopWorkArea($hWnd) 35 | ;Prevent Windows from misplacing the GUI when maximized. (Due to missing borders.) 36 | DllStructSetData($tMinMax, 3, $WrkSize[2]) 37 | DllStructSetData($tMinMax, 4, $WrkSize[3]) 38 | DllStructSetData($tMinMax, 5, $WrkSize[0] + 1) 39 | DllStructSetData($tMinMax, 6, $WrkSize[1] + 1) 40 | ;Min Size limits 41 | DllStructSetData($tMinMax, 7, $GLOBAL_GUI_LIST[$iGui_Count][3]) 42 | DllStructSetData($tMinMax, 8, $GLOBAL_GUI_LIST[$iGui_Count][4]) 43 | Return 0 44 | Else 45 | Return 'GUI_RUNDEFMSG' 46 | EndIf 47 | EndFunc ;==>INTERNAL_WM_GETMINMAXINFO 48 | 49 | ;Set mouse cursor for resizing etc. / Allow the upper GUI (40 pixel from top) to act as a control bar (doubleclick to maximize, move gui around..) 50 | Func INTERNAL_WM_NCHITTEST($hWnd, $uMsg, $wParam, $lParam) 51 | 52 | Local $iGui_Count = _Int_GetGUIID($hWnd) 53 | If @error Then Return 'GUI_RUNDEFMSG' 54 | 55 | If $GLOBAL_GUI_LIST[$iGui_Count][2] Then 56 | Local $iSide = 0, $iTopBot = 0, $CurSorInfo 57 | 58 | Local $mPos = MouseGetPos() 59 | Local $aWinPos = WinGetPos($hWnd) 60 | Local $curInf = GUIGetCursorInfo($hWnd) 61 | 62 | ;Check if Mouse is over Border, Margin = 5 63 | Local $bMarg=5*$gDPI 64 | If Not @error Then 65 | If $curInf[0] < $bMarg Then $iSide = 1 66 | If $curInf[0] > $aWinPos[2] - $bMarg Then $iSide = 2 67 | If $curInf[1] < $bMarg Then $iTopBot = 3 68 | If $curInf[1] > $aWinPos[3] - $bMarg Then $iTopBot = 6 69 | $CurSorInfo = $iSide + $iTopBot 70 | Else 71 | $CurSorInfo = 0 72 | EndIf 73 | 74 | Local $tMarg = 32* $gDPI 75 | ;Set position for drag and doubleclick to maximize 76 | Local $xMIN, $xMAX, $yMIN, $yMAX 77 | $xMIN = $aWinPos[0] + 4 78 | $xMAX = $aWinPos[0] + $aWinPos[2] - 4 79 | $yMIN = $aWinPos[1] + 4 80 | $yMAX = $aWinPos[1] + $tMarg 81 | If WinActive($hWnd) Then 82 | If ($mPos[0] >= $xMIN) And ($mPos[0] <= $xMAX) And ($mPos[1] >= $yMIN) And ($mPos[1] <= $yMAX) Then 83 | GUISetCursor(2, 1) 84 | Return 2 ; Return $HTCAPTION if mouse is within the position for drag + doubleclick to maximize 85 | EndIf 86 | EndIf 87 | If Not (WinGetState($hWnd) = 47) Then 88 | ;Set resize cursor and return the correct $HT for gui resizing 89 | If ($curInf[4] < 8) Then 90 | Local $Return_HT = 2, $Set_Cursor = 2 91 | Switch $CurSorInfo 92 | Case 1 93 | $Set_Cursor = 13 94 | $Return_HT = 10 95 | Case 2 96 | $Set_Cursor = 13 97 | $Return_HT = 11 98 | Case 3 99 | $Set_Cursor = 11 100 | $Return_HT = 12 101 | Case 4 102 | $Set_Cursor = 12 103 | $Return_HT = 13 104 | Case 5 105 | $Set_Cursor = 10 106 | $Return_HT = 14 107 | Case 6 108 | $Set_Cursor = 11 109 | $Return_HT = 15 110 | Case 7 111 | $Set_Cursor = 10 112 | $Return_HT = 16 113 | Case 8 114 | $Set_Cursor = 12 115 | $Return_HT = 17 116 | EndSwitch 117 | GUISetCursor($Set_Cursor, 1) 118 | If Not ($Return_HT = 2) Then Return $Return_HT 119 | EndIf 120 | EndIf 121 | EndIf 122 | 123 | Return 'GUI_RUNDEFMSG' 124 | EndFunc ;==>INTERNAL_WM_NCHITTEST 125 | 126 | ; Allow drag with mouse left button down 127 | Func INTERNAL_WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) 128 | 129 | Local $iGui_Count = _Int_GetGUIID($hWnd) 130 | If @error Then Return 'GUI_RUNDEFMSG' 131 | 132 | If $GLOBAL_GUI_LIST[$iGui_Count][1] Then 133 | If Not (WinGetState($hWnd) = 47) Then 134 | Local $aCurInfo = GUIGetCursorInfo($hWnd) 135 | If ($aCurInfo[4] = 0) Then ; Mouse not over a control 136 | DllCall("user32.dll", "int", "ReleaseCapture") 137 | DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", 0x00A1, "int", 2, "int", 0) 138 | Return 0 139 | EndIf 140 | EndIf 141 | EndIf 142 | Return 'GUI_RUNDEFMSG' 143 | EndFunc ;==>INTERNAL_WM_LBUTTONDOWN 144 | 145 | 146 | ; #FUNCTION# ==================================================================================================================== 147 | ; Name ..........: _GetDesktopWorkArea 148 | ; Description ...: Calculate the desktop workarea for a specific window to maximize it. Supports multi display and taskbar detection. 149 | ; Syntax ........: _GetDesktopWorkArea($hWnd) 150 | ; Parameters ....: $hWnd - Handle to the window. 151 | ; Return values .: Array in following format: 152 | ; : [0] = X-Pos for maximizing 153 | ; : [1] = Y-Pos for maximizing 154 | ; : [2] = Max. Width 155 | ; : [3] = Max. Height 156 | ; Author ........: BB_19 157 | ; Note ..........: The x/y position is not the real position of the window if you have multi display. It is just for setting the maximize info for WM_GETMINMAXINFO 158 | ; =============================================================================================================================== 159 | Func _GetDesktopWorkArea($hWnd, $FullScreen = False) 160 | 161 | Local $MonSizePos[4], $MonNumb = 1 162 | $MonSizePos[0] = 0 163 | $MonSizePos[1] = 0 164 | $MonSizePos[2] = @DesktopWidth 165 | $MonSizePos[3] = @DesktopHeight 166 | 167 | ;Get Monitors 168 | Local $aPos, $MonList = _WinAPI_EnumDisplayMonitors() 169 | If @error Then Return $MonSizePos 170 | 171 | If IsArray($MonList) Then 172 | ReDim $MonList[$MonList[0][0] + 1][5] 173 | For $i = 1 To $MonList[0][0] 174 | $aPos = _WinAPI_GetPosFromRect($MonList[$i][1]) 175 | For $j = 0 To 3 176 | $MonList[$i][$j + 1] = $aPos[$j] 177 | Next 178 | Next 179 | EndIf 180 | 181 | ;Check on which monitor our window is 182 | Local $GUI_Monitor = _WinAPI_MonitorFromWindow($hWnd) 183 | 184 | ;Check on which monitor the taskbar is 185 | Local $TaskbarMon = _WinAPI_MonitorFromWindow(WinGetHandle("[CLASS:Shell_TrayWnd]")) 186 | 187 | ;Write the width and height info of the correct monitor into an array 188 | For $iM = 1 To $MonList[0][0] Step +1 189 | If $MonList[$iM][0] = $GUI_Monitor Then 190 | If $FullScreen Then 191 | $MonSizePos[0] = $MonList[$iM][1] 192 | $MonSizePos[1] = $MonList[$iM][2] 193 | Else 194 | $MonSizePos[0] = 0 195 | $MonSizePos[1] = 0 196 | EndIf 197 | $MonSizePos[2] = $MonList[$iM][3] 198 | $MonSizePos[3] = $MonList[$iM][4] 199 | $MonNumb = $iM 200 | EndIf 201 | Next 202 | 203 | 204 | ;Check if Taskbar autohide is enabled, if so then we will remove 1px from the correct side so that the taskbar will reapear when moving mouse to the side 205 | Local $TaskBarAH = DllCall("shell32.dll", "int", "SHAppBarMessage", "int", 0x00000004, "ptr*", 0) 206 | If Not @error Then 207 | $TaskBarAH = $TaskBarAH[0] 208 | Else 209 | $TaskBarAH = 0 210 | EndIf 211 | 212 | 213 | ;Check if Taskbar is on this Monitor, if so, then recalculate the position, max. width and height of the WorkArea 214 | If $TaskbarMon = $GUI_Monitor Then 215 | Local $TaskBarPos = WinGetPos("[CLASS:Shell_TrayWnd]") 216 | If @error Then Return $MonSizePos 217 | If $FullScreen = True Then Return $MonSizePos 218 | 219 | ;Win 7 classic theme compatibility 220 | If ($TaskBarPos[0] = $MonList[$MonNumb][1] - 2) Or ($TaskBarPos[1] = $MonList[$MonNumb][2] - 2) Then 221 | $TaskBarPos[0] = $TaskBarPos[0] + 2 222 | $TaskBarPos[1] = $TaskBarPos[1] + 2 223 | $TaskBarPos[2] = $TaskBarPos[2] - 4 224 | $TaskBarPos[3] = $TaskBarPos[3] - 4 225 | EndIf 226 | If ($TaskBarPos[0] = $MonList[$MonNumb][1] - 2) Or ($TaskBarPos[1] = $MonList[$MonNumb][2] - 2) Then 227 | $TaskBarPos[0] = $TaskBarPos[0] + 2 228 | $TaskBarPos[1] = $TaskBarPos[1] + 2 229 | $TaskBarPos[2] = $TaskBarPos[2] - 4 230 | $TaskBarPos[3] = $TaskBarPos[3] - 4 231 | EndIf 232 | 233 | 234 | ;Recalc width/height and pos 235 | If $TaskBarPos[2] = $MonSizePos[2] Then 236 | If $TaskBarAH = 1 Then 237 | If ($TaskBarPos[1] > 0) Then 238 | $MonSizePos[3] -= 1 239 | Else 240 | $MonSizePos[1] += 1 241 | $MonSizePos[3] -= 1 242 | EndIf 243 | Return $MonSizePos 244 | EndIf 245 | $MonSizePos[3] = $MonSizePos[3] - $TaskBarPos[3] 246 | If ($TaskBarPos[0] = $MonList[$MonNumb][1]) And ($TaskBarPos[1] = $MonList[$MonNumb][2]) Then $MonSizePos[1] = $TaskBarPos[3] 247 | Else 248 | If $TaskBarAH = 1 Then 249 | If ($TaskBarPos[0] > 0) Then 250 | $MonSizePos[2] -= 1 251 | Else 252 | $MonSizePos[0] += 1 253 | $MonSizePos[2] -= 1 254 | EndIf 255 | Return $MonSizePos 256 | EndIf 257 | $MonSizePos[2] = $MonSizePos[2] - $TaskBarPos[2] 258 | If ($TaskBarPos[0] = $MonList[$MonNumb][1]) And ($TaskBarPos[1] = $MonList[$MonNumb][2]) Then $MonSizePos[0] = $TaskBarPos[2] 259 | EndIf 260 | EndIf 261 | Return $MonSizePos 262 | EndFunc ;==>_GetDesktopWorkArea 263 | 264 | 265 | Func _Int_GetGUIID($mGUI) 266 | Local $iGui_Count 267 | For $iGUIs = 0 To UBound($GLOBAL_GUI_LIST) - 1 Step +1 268 | If $GLOBAL_GUI_LIST[$iGUIs][0] = $mGUI Then 269 | $iGui_Count = $iGUIs 270 | ExitLoop 271 | EndIf 272 | Next 273 | If ($iGui_Count == "") Then 274 | Return SetError(1); 275 | EndIf 276 | Return $iGui_Count 277 | EndFunc 278 | -------------------------------------------------------------------------------- /Lib/MetroGUI-UDF/MetroUDF-Required/StringSize.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ============================================================================================================ 4 | ; Title .........: _StringSize 5 | ; AutoIt Version : v3.2.12.1 or higher 6 | ; Language ......: English 7 | ; Description ...: Returns size of rectangle required to display string - maximum width can be chosen 8 | ; Remarks .......: 9 | ; Note ..........: 10 | ; Author(s) .....: Melba23 - thanks to trancexx for the default DC code 11 | ; ==================================================================================================================== 12 | 13 | ;#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 14 | 15 | ; #CURRENT# ========================================================================================================== 16 | ; _StringSize: Returns size of rectangle required to display string - maximum width can be chosen 17 | ; ==================================================================================================================== 18 | 19 | ; #INTERNAL_USE_ONLY#================================================================================================= 20 | ; _StringSize_Error_Close: Releases DC and deletes font object after error 21 | ; _StringSize_DefaultFontName: Determines Windows default font 22 | ; ==================================================================================================================== 23 | 24 | ; #FUNCTION# ========================================================================================================= 25 | ; Name...........: _StringSize 26 | ; Description ...: Returns size of rectangle required to display string - maximum permitted width can be chosen 27 | ; Syntax ........: _StringSize($sText[, $iSize[, $iWeight[, $iAttrib[, $sName[, $iWidth[, $hWnd]]]]]]) 28 | ; Parameters ....: $sText - String to display 29 | ; $iSize - [optional] Font size in points - (default = 8.5) 30 | ; $iWeight - [optional] Font weight - (default = 400 = normal) 31 | ; $iAttrib - [optional] Font attribute (0-Normal (default), 2-Italic, 4-Underline, 8 Strike) 32 | ; + 1 if tabs are to be expanded before sizing 33 | ; $sName - [optional] Font name - (default = Tahoma) 34 | ; $iWidth - [optional] Max width for rectangle - (default = 0 => width of original string) 35 | ; $hWnd - [optional] GUI in which string will be displayed - (default 0 => normally not required) 36 | ; Requirement(s) : v3.2.12.1 or higher 37 | ; Return values .: Success - Returns 4-element array: ($iWidth set // $iWidth not set) 38 | ; |$array[0] = String reformatted with additonal @CRLF // Original string 39 | ; |$array[1] = Height of single line in selected font // idem 40 | ; |$array[2] = Width of rectangle required for reformatted // original string 41 | ; |$array[3] = Height of rectangle required for reformatted // original string 42 | ; Failure - Returns 0 and sets @error: 43 | ; |1 - Incorrect parameter type (@extended = parameter index) 44 | ; |2 - DLL call error - extended set as follows: 45 | ; |1 - GetDC failure 46 | ; |2 - SendMessage failure 47 | ; |3 - GetDeviceCaps failure 48 | ; |4 - CreateFont failure 49 | ; |5 - SelectObject failure 50 | ; |6 - GetTextExtentPoint32 failure 51 | ; |3 - Font too large for chosen max width - a word will not fit 52 | ; Author ........: Melba23 - thanks to trancexx for the default DC code 53 | ; Modified ......: 54 | ; Remarks .......: The use of the $hWnd parameter is not normally necessary - it is only required if the UDF does not 55 | ; return correct dimensions without it. 56 | ; Related .......: 57 | ; Link ..........: 58 | ; Example .......: Yes 59 | ;===================================================================================================================== 60 | Func _StringSize($sText, $iSize = 8.5, $iWeight = 400, $iAttrib = 0, $sName = "", $iMaxWidth = 0, $hWnd = 0) 61 | 62 | ; Set parameters passed as Default 63 | If $iSize = Default Then $iSize = 8.5 64 | If $iWeight = Default Then $iWeight = 400 65 | If $iAttrib = Default Then $iAttrib = 0 66 | If $sName = "" Or $sName = Default Then $sName = _StringSize_DefaultFontName() 67 | 68 | ; Check parameters are correct type 69 | If Not IsString($sText) Then Return SetError(1, 1, 0) 70 | If Not IsNumber($iSize) Then Return SetError(1, 2, 0) 71 | If Not IsInt($iWeight) Then Return SetError(1, 3, 0) 72 | If Not IsInt($iAttrib) Then Return SetError(1, 4, 0) 73 | If Not IsString($sName) Then Return SetError(1, 5, 0) 74 | If Not IsNumber($iMaxWidth) Then Return SetError(1, 6, 0) 75 | If Not IsHwnd($hWnd) And $hWnd <> 0 Then Return SetError(1, 7, 0) 76 | 77 | Local $aRet, $hDC, $hFont, $hLabel = 0, $hLabel_Handle 78 | 79 | ; Check for tab expansion flag 80 | Local $iExpTab = BitAnd($iAttrib, 1) 81 | ; Remove possible tab expansion flag from font attribute value 82 | $iAttrib = BitAnd($iAttrib, BitNot(1)) 83 | 84 | ; If GUI handle was passed 85 | If IsHWnd($hWnd) Then 86 | ; Create label outside GUI borders 87 | $hLabel = GUICtrlCreateLabel("", -10, -10, 10, 10) 88 | $hLabel_Handle = GUICtrlGetHandle(-1) 89 | GUICtrlSetFont(-1, $iSize, $iWeight, $iAttrib, $sName) 90 | ; Create DC 91 | $aRet = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hLabel_Handle) 92 | If @error Or $aRet[0] = 0 Then 93 | GUICtrlDelete($hLabel) 94 | Return SetError(2, 1, 0) 95 | EndIf 96 | $hDC = $aRet[0] 97 | $aRet = DllCall("user32.dll", "lparam", "SendMessage", "hwnd", $hLabel_Handle, "int", 0x0031, "wparam", 0, "lparam", 0) ; $WM_GetFont 98 | If @error Or $aRet[0] = 0 Then 99 | GUICtrlDelete($hLabel) 100 | Return SetError(2, _StringSize_Error_Close(2, $hDC), 0) 101 | EndIf 102 | $hFont = $aRet[0] 103 | Else 104 | ; Get default DC 105 | $aRet = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hWnd) 106 | If @error Or $aRet[0] = 0 Then Return SetError(2, 1, 0) 107 | $hDC = $aRet[0] 108 | ; Create required font 109 | $aRet = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hDC, "int", 90) ; $LOGPIXELSY 110 | If @error Or $aRet[0] = 0 Then Return SetError(2, _StringSize_Error_Close(3, $hDC), 0) 111 | Local $iInfo = $aRet[0] 112 | $aRet = DllCall("gdi32.dll", "handle", "CreateFontW", "int", -$iInfo * $iSize / 72, "int", 0, "int", 0, "int", 0, _ 113 | "int", $iWeight, "dword", BitAND($iAttrib, 2), "dword", BitAND($iAttrib, 4), "dword", BitAND($iAttrib, 8), "dword", 0, "dword", 0, _ 114 | "dword", 0, "dword", 5, "dword", 0, "wstr", $sName) 115 | If @error Or $aRet[0] = 0 Then Return SetError(2, _StringSize_Error_Close(4, $hDC), 0) 116 | $hFont = $aRet[0] 117 | EndIf 118 | 119 | ; Select font and store previous font 120 | $aRet = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hDC, "handle", $hFont) 121 | If @error Or $aRet[0] = 0 Then Return SetError(2, _StringSize_Error_Close(5, $hDC, $hFont, $hLabel), 0) 122 | Local $hPrevFont = $aRet[0] 123 | 124 | ; Declare variables 125 | Local $avSize_Info[4], $iLine_Length, $iLine_Height = 0, $iLine_Count = 0, $iLine_Width = 0, $iWrap_Count, $iLast_Word, $sTest_Line 126 | ; Declare and fill Size structure 127 | Local $tSize = DllStructCreate("int X;int Y") 128 | DllStructSetData($tSize, "X", 0) 129 | DllStructSetData($tSize, "Y", 0) 130 | 131 | ; Ensure EoL is @CRLF and break text into lines 132 | $sText = StringRegExpReplace($sText, "((? $iLine_Width Then $iLine_Width = DllStructGetData($tSize, "X") 146 | If DllStructGetData($tSize, "Y") > $iLine_Height Then $iLine_Height = DllStructGetData($tSize, "Y") 147 | Next 148 | 149 | ; Check if $iMaxWidth has been both set and exceeded 150 | If $iMaxWidth <> 0 And $iLine_Width > $iMaxWidth Then ; Wrapping required 151 | ; For each Line 152 | For $j = 1 To $asLines[0] 153 | ; Size line unwrapped 154 | $iLine_Length = StringLen($asLines[$j]) 155 | DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hDC, "wstr", $asLines[$j], "int", $iLine_Length, "ptr", DllStructGetPtr($tSize)) 156 | If @error Then Return SetError(2, _StringSize_Error_Close(6, $hDC, $hFont, $hLabel), 0) 157 | ; Check wrap status 158 | If DllStructGetData($tSize, "X") < $iMaxWidth - 4 Then 159 | ; No wrap needed so count line and store 160 | $iLine_Count += 1 161 | $avSize_Info[0] &= $asLines[$j] & @CRLF 162 | Else 163 | ; Wrap needed so zero counter for wrapped lines 164 | $iWrap_Count = 0 165 | ; Build line to max width 166 | While 1 167 | ; Zero line width 168 | $iLine_Width = 0 169 | ; Initialise pointer for end of word 170 | $iLast_Word = 0 171 | ; Add characters until EOL or maximum width reached 172 | For $i = 1 To StringLen($asLines[$j]) 173 | ; Is this just past a word ending? 174 | If StringMid($asLines[$j], $i, 1) = " " Then $iLast_Word = $i - 1 175 | ; Increase line by one character 176 | $sTest_Line = StringMid($asLines[$j], 1, $i) 177 | ; Get line length 178 | $iLine_Length = StringLen($sTest_Line) 179 | DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hDC, "wstr", $sTest_Line, "int", $iLine_Length, "ptr", DllStructGetPtr($tSize)) 180 | If @error Then Return SetError(2, _StringSize_Error_Close(6, $hDC, $hFont, $hLabel), 0) 181 | $iLine_Width = DllStructGetData($tSize, "X") 182 | ; If too long exit the loop 183 | If $iLine_Width >= $iMaxWidth - 4 Then ExitLoop 184 | Next 185 | ; End of the line of text? 186 | If $i > StringLen($asLines[$j]) Then 187 | ; Yes, so add final line to count 188 | $iWrap_Count += 1 189 | ; Store line 190 | $avSize_Info[0] &= $sTest_Line & @CRLF 191 | ExitLoop 192 | Else 193 | ; No, but add line just completed to count 194 | $iWrap_Count += 1 195 | ; Check at least 1 word completed or return error 196 | If $iLast_Word = 0 Then Return SetError(3, _StringSize_Error_Close(0, $hDC, $hFont, $hLabel), 0) 197 | ; Store line up to end of last word 198 | $avSize_Info[0] &= StringLeft($sTest_Line, $iLast_Word) & @CRLF 199 | ; Strip string to point reached 200 | $asLines[$j] = StringTrimLeft($asLines[$j], $iLast_Word) 201 | ; Trim leading whitespace 202 | $asLines[$j] = StringStripWS($asLines[$j], 1) 203 | ; Repeat with remaining characters in line 204 | EndIf 205 | WEnd 206 | ; Add the number of wrapped lines to the count 207 | $iLine_Count += $iWrap_Count 208 | EndIf 209 | Next 210 | ; Reset any tab expansions 211 | If $iExpTab Then 212 | $avSize_Info[0] = StringRegExpReplace($avSize_Info[0], "\x20?XXXXXXXX", @TAB) 213 | EndIf 214 | ; Complete return array 215 | $avSize_Info[1] = $iLine_Height 216 | $avSize_Info[2] = $iMaxWidth 217 | ; Convert lines to pixels and add drop margin 218 | $avSize_Info[3] = ($iLine_Count * $iLine_Height) + 4 219 | Else ; No wrapping required 220 | ; Create return array (add drop margin to height) 221 | Local $avSize_Info[4] = [$sText, $iLine_Height, $iLine_Width, ($asLines[0] * $iLine_Height) + 4] 222 | EndIf 223 | 224 | ; Clear up 225 | DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hDC, "handle", $hPrevFont) 226 | DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hFont) 227 | DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "handle", $hDC) 228 | If $hLabel Then GUICtrlDelete($hLabel) 229 | 230 | Return $avSize_Info 231 | 232 | EndFunc ;==>_StringSize 233 | 234 | ; #INTERNAL_USE_ONLY#============================================================================================================ 235 | ; Name...........: _StringSize_Error_Close 236 | ; Description ...: Releases DC and deleted font object if required after error 237 | ; Syntax ........: _StringSize_Error_Close ($iExtCode, $hDC, $hGUI) 238 | ; Parameters ....: $iExtCode - code to return 239 | ; $hDC, $hGUI - handles as set in _StringSize function 240 | ; Return value ..: $iExtCode as passed 241 | ; Author ........: Melba23 242 | ; Modified.......: 243 | ; Remarks .......: This function is used internally by _StringSize 244 | ; =============================================================================================================================== 245 | Func _StringSize_Error_Close($iExtCode, $hDC = 0, $hFont = 0, $hLabel = 0) 246 | 247 | If $hFont <> 0 Then DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hFont) 248 | If $hDC <> 0 Then DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "handle", $hDC) 249 | If $hLabel Then GUICtrlDelete($hLabel) 250 | 251 | Return $iExtCode 252 | 253 | EndFunc ;=>_StringSize_Error_Close 254 | 255 | ; #INTERNAL_USE_ONLY#============================================================================================================ 256 | ; Name...........: _StringSize_DefaultFontName 257 | ; Description ...: Determines Windows default font 258 | ; Syntax ........: _StringSize_DefaultFontName() 259 | ; Parameters ....: None 260 | ; Return values .: Success - Returns name of system default font 261 | ; Failure - Returns "Tahoma" 262 | ; Author ........: Melba23, based on some original code by Larrydalooza 263 | ; Modified.......: 264 | ; Remarks .......: This function is used internally by _StringSize 265 | ; =============================================================================================================================== 266 | Func _StringSize_DefaultFontName() 267 | 268 | ; Get default system font data 269 | Local $tNONCLIENTMETRICS = DllStructCreate("uint;int;int;int;int;int;byte[60];int;int;byte[60];int;int;byte[60];byte[60];byte[60]") 270 | DLLStructSetData($tNONCLIENTMETRICS, 1, DllStructGetSize($tNONCLIENTMETRICS)) 271 | DLLCall("user32.dll", "int", "SystemParametersInfo", "int", 41, "int", DllStructGetSize($tNONCLIENTMETRICS), "ptr", DllStructGetPtr($tNONCLIENTMETRICS), "int", 0) 272 | Local $tLOGFONT = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DLLStructGetPtr($tNONCLIENTMETRICS, 13)) 273 | If IsString(DllStructGetData($tLOGFONT, 14)) Then 274 | Return DllStructGetData($tLOGFONT, 14) 275 | Else 276 | Return "Tahoma" 277 | EndIf 278 | 279 | EndFunc ;=>_StringSize_DefaultFontName 280 | -------------------------------------------------------------------------------- /Lib/MetroGUI-UDF/MetroUDF-Required/_GUIDisable.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 4 | ; #INDEX# ======================================================================================================================= 5 | ; Title .........: _GUIDisable 6 | ; AutoIt Version : v3.2.2.0 or higher 7 | ; Language ......: English 8 | ; Description ...: Creates a dimming effect on the current/selected GUI. 9 | ; Note ..........: 10 | ; Author(s) .....: guinness 11 | ; Remarks .......: Thanks to supersonic for the idea of adjusting the UDF when using Classic themes in Windows Vista+. 12 | ; =============================================================================================================================== 13 | 14 | ; #INCLUDES# ==================================================================================================================== 15 | #include 16 | #include 17 | #include 18 | 19 | ; #GLOBAL VARIABLES# ============================================================================================================ 20 | Global Enum $__hGUIDisableHWnd, $__hGUIDisableHWndPrevious, $__iGUIDisableMax 21 | Global $__aGUIDisable[$__iGUIDisableMax] 22 | 23 | Func _GUIDisable($hWnd, $iAnimate = Default, $iBrightness = Default, $bColor = 0x000000) 24 | Local Const $AW_SLIDE_IN_TOP = 0x00040004, $AW_SLIDE_OUT_TOP = 0x00050008 25 | 26 | If $iAnimate = Default Then 27 | $iAnimate = 1 28 | EndIf 29 | If $iBrightness = Default Then 30 | $iBrightness = 5 31 | EndIf 32 | 33 | If $hWnd = -1 And $__aGUIDisable[$__hGUIDisableHWnd] = 0 Then 34 | Local $iLabel = GUICtrlCreateLabel('', -99, -99, 1, 1) 35 | $hWnd = _WinAPI_GetParent(GUICtrlGetHandle($iLabel)) 36 | If @error Then 37 | Return SetError(1, 0 * GUICtrlDelete($iLabel), 0) 38 | EndIf 39 | GUICtrlDelete($iLabel) 40 | EndIf 41 | 42 | If IsHWnd($__aGUIDisable[$__hGUIDisableHWnd]) Then 43 | GUIDelete($__aGUIDisable[$__hGUIDisableHWnd]) 44 | GUISwitch($__aGUIDisable[$__hGUIDisableHWndPrevious]) 45 | $__aGUIDisable[$__hGUIDisableHWnd] = 0 46 | $__aGUIDisable[$__hGUIDisableHWndPrevious] = 0 47 | Else 48 | $__aGUIDisable[$__hGUIDisableHWndPrevious] = $hWnd 49 | 50 | Local $iLeft = 0, $iTop = 0 51 | Local $iStyle = GUIGetStyle($__aGUIDisable[$__hGUIDisableHWndPrevious]) 52 | Local $sCurrentTheme = RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes', 'CurrentTheme') 53 | Local $iIsClassicTheme = Number(StringInStr($sCurrentTheme, 'Basic.theme', 2) = 0 And StringInStr($sCurrentTheme, 'Ease of Access Themes', 2) > 0) 54 | 55 | Local $aWinGetPos = WinGetClientSize($__aGUIDisable[$__hGUIDisableHWndPrevious]) 56 | $__aGUIDisable[$__hGUIDisableHWnd] = GUICreate('', $aWinGetPos[0], $aWinGetPos[1], $iLeft + 3, $iTop + 3, $WS_POPUP, $WS_EX_MDICHILD, $__aGUIDisable[$__hGUIDisableHWndPrevious]) 57 | GUISetBkColor($bColor, $__aGUIDisable[$__hGUIDisableHWnd]) 58 | WinSetTrans($__aGUIDisable[$__hGUIDisableHWnd], '', Round($iBrightness * (255 / 100))) 59 | If not $iAnimate Then 60 | GUISetState(@SW_SHOW, $__aGUIDisable[$__hGUIDisableHWnd]) 61 | EndIf 62 | GUISetState(@SW_DISABLE, $__aGUIDisable[$__hGUIDisableHWnd]) 63 | GUISwitch($__aGUIDisable[$__hGUIDisableHWndPrevious]) 64 | EndIf 65 | Return $__aGUIDisable[$__hGUIDisableHWnd] 66 | EndFunc ;==>_GUIDisable 67 | 68 | ; #INTERNAL_USE_ONLY#============================================================================================================ 69 | Func __GUIDisable_WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) 70 | #forceref $hWnd, $iMsg, $iwParam 71 | Local $iHeight = _WinAPI_HiWord($ilParam) 72 | Local $iWidth = _WinAPI_LoWord($ilParam) 73 | If $hWnd = $__aGUIDisable[$__hGUIDisableHWndPrevious] Then 74 | Local $iWinGetPos = WinGetPos($__aGUIDisable[$__hGUIDisableHWnd]) 75 | If @error = 0 Then 76 | WinMove($__aGUIDisable[$__hGUIDisableHWnd], '', $iWinGetPos[0], $iWinGetPos[1], $iWidth, $iHeight) 77 | EndIf 78 | EndIf 79 | Return $GUI_RUNDEFMSG 80 | EndFunc ;==>__GUIDisable_WM_SIZE 81 | --------------------------------------------------------------------------------