| iBiscottino |
| | Si la prima è abbastanza banale però può rivelarsi utile.. come in un mio caso in cui dovevo creare un bottone-immagine in stile è quella funzione si è rivelata parecchio comoda Ormai ero abituato alla funzione che estende completamente lo stile di Windows (sempre per un progetto) e mi sono scordato di postare quella in cui si possono settare i margini: CODICE Func ApplyWinFrameArea($hWnd, $Left, $Right, $Top, $Bottom) $Struct = DllStructCreate("int Left; int Right; int Top; int Bottom") DllStructSetData($Struct, "Left", $Left) DllStructSetData($Struct, "Right", $Right) DllStructSetData($Struct, "Top", $Top) DllStructSetData($Struct, "Bottom", $Bottom) $Ptr = DllStructGetPtr($Struct) GUISetBkColor(0x000000, $hWnd) DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", $Ptr) EndFunc ;==>ApplyWinFrameArea Ora già che ci sono posto un paio di esempi: CODICE #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "_Exit") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("", 287, 220, 192, 146, BitOR($WS_MINIMIZEBOX,$WS_GROUP)) ApplyWinFrameArea($Form1, 3, 3, 40, 40) ApplyBlurFrame($Form1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ###
While 1 WEnd
Func _Exit() Exit EndFunc
Func ApplyWinFrameArea($hWnd, $Left, $Right, $Top, $Bottom) $Struct = DllStructCreate("int Left; int Right; int Top; int Bottom") DllStructSetData($Struct, "Left", $Left) DllStructSetData($Struct, "Right", $Right) DllStructSetData($Struct, "Top", $Top) DllStructSetData($Struct, "Bottom", $Bottom) $Ptr = DllStructGetPtr($Struct) GUISetBkColor(0x000000, $hWnd) DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", $Ptr) EndFunc ;==>ApplyWinFrameArea
Func ApplyBlurFrame($hWnd) $Struct = DllStructCreate("dword;int;ptr;int") DllStructSetData($Struct, 1, 0x00000001) DllStructSetData($Struct, 2, "1") DllStructSetData($Struct, 3, -1) DllStructSetData($Struct, 4, "1") $Ptr = DllStructGetPtr($Struct) GUISetBkColor(0x000000, $hWnd) DllCall("dwmapi.dll", "int", "DwmEnableBlurBehindWindow", "hwnd", $hWnd, "ptr", $Ptr) EndFunc ;==>ApplyBlurFrame CODICE #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("", 190, 120, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_GROUP)) $Label1 = GUICtrlCreateLabel("Questo label cambia colore!", 25, 35, 200, 15) $Button1 = GUICtrlCreateButton("Esci", 80, 60, 50, 20) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ###
While 1 While IsOver($Form1, $Label1) GUICtrlSetColor($Label1, 0x0000FF) While IsOver($Form1, $Label1) If GUIGetMsg() = $Label1 Then MsgBox(0, "", "Label premuto") WEnd GUICtrlSetColor($Label1, 0x000000) WEnd $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 Exit EndSwitch WEnd
Func IsOver($hWnd, $hCtrl = Default) If $hWnd = "" Or $hCtrl = "" Then SetError(1) Return False Else $CI = GUIGetCursorInfo($hWnd) If $CI[4] = $hCtrl Then Return True Else Return False EndIf EndIf EndFunc ;==>IsOver
| | |
| |
|