GraaF1337 Posted October 30, 2014 Share Posted October 30, 2014 This allows me to make a GUI and make the background transparrent, and place a picture on it. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <WinAPI.au3> #include <ColorConstantS.au3> $Form1 = GUICreate("Form1", 200, 200, 663, 317, -1, $WS_EX_LAYERED) GUISetBkColor(0x0000F4) GUICtrlCreateGraphic(0, 100, 200, 1) GUICtrlSetBkColor(-1, 0x000000) GUICtrlCreateGraphic(0, 50, 200, 1) GUICtrlSetBkColor(-1, 0x000000) GUICtrlCreateGraphic(0, 150, 200, 1) GUICtrlSetBkColor(-1, 0x000000) GUICtrlCreateGraphic(100, 0, 1, 200) GUICtrlSetBkColor(-1, 0x000000) GUICtrlCreateGraphic(50, 0, 1, 200) GUICtrlSetBkColor(-1, 0x000000) GUICtrlCreateGraphic(150, 0, 1, 200) GUICtrlSetBkColor(-1, 0x000000) $Pic1 = GUICtrlCreatePic("C:\Users\Toft\Desktop\dot.bmp", 50, 50, 100, 100) _WinAPI_SetLayeredWindowAttributes($Form1, 0x0000F4) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd But i was wondering is there is any way to make the picture it self 40-50% transparent? Link to comment Share on other sites More sharing options...
MikahS Posted October 30, 2014 Share Posted October 30, 2014 Have a look at this >link Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
johnmcloud Posted October 30, 2014 Share Posted October 30, 2014 (edited) expandcollapse popup; Johnmcloud - 2014 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global Const $SM_CXFIXEDFRAME = 7 Global Const $hTitlebar = _WinAPI_GetSystemMetrics($SM_CYCAPTION) Global Const $hBorder = _WinAPI_GetSystemMetrics($SM_CXFIXEDFRAME) $hGUI = GUICreate("Johnmcloud Test Code", 169, 200, -1, -1, -1, $WS_EX_LAYERED) GUISetBkColor(0xABCDEF) $Button = GUICtrlCreateButton("Test", 50, 65, 70, 50) $aGUIPos = WinGetPos($hGUI) If @error Then Exit $hChild = GUICreate("", 169, 200, $aGUIPos[0] + $hBorder, $aGUIPos[1] + ($hTitlebar + $hBorder), BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOOLWINDOW) $Pic1 = GUICtrlCreatePic(@ScriptDir & "\logo4.gif", 0, 0, 169, 68) GUICtrlSetState(-1, $GUI_DISABLE) $Pic2 = GUICtrlCreatePic(@ScriptDir & "\logo4.gif", 0, 68, 169, 68) GUICtrlSetState(-1, $GUI_DISABLE) $Pic3 = GUICtrlCreatePic(@ScriptDir & "\logo4.gif", 0, 136, 169, 68) GUICtrlSetState(-1, $GUI_DISABLE) WinSetTrans($hChild, "", 50) GUISetState(@SW_SHOWNOACTIVATE, $hChild) GUISetState(@SW_SHOW, $hGUI) _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 255) GUIRegisterMsg($WM_MOVE, "WM_MOVE") While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_MINIMIZE GUISetState(@SW_HIDE, $hChild) Case $GUI_EVENT_RESTORE GUISetState(@SW_SHOW, $hChild) WinActivate($hGUI) Case $GUI_EVENT_CLOSE Exit Case $Button ConsoleWrite("Button" & @CR) EndSwitch Case $hChild Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN ControlFocus($hGUI, "", $Button) EndSwitch EndSwitch WEnd Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam, $lParam If $hWnd <> $hGUI Then Return Local $aPos = WinGetPos($hGUI) WinMove($hChild, "", $aPos[0] + $hBorder, $aPos[1] + ($hTitlebar + $hBorder)) EndFunc ;==>WM_MOVE logo4.gif Edited October 31, 2014 by johnmcloud Link to comment Share on other sites More sharing options...
GraaF1337 Posted October 30, 2014 Author Share Posted October 30, 2014 expandcollapse popup; Jonhmcloud - 2014 #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> $hGUI = GUICreate("Johnmcloud Test GUI", 169, 200, -1, -1, -1, $WS_EX_LAYERED) GUISetBkColor(0x0000F4) $Pic1 = GUICtrlCreatePic(@ScriptDir & "\logo4.gif", 0, 0, 169, 68) ControlSetTrans(-1, 50) $Pic2 = GUICtrlCreatePic(@ScriptDir & "\logo4.gif", 0, 68, 169, 68) ControlSetTrans(-1, 50) $Pic3 = GUICtrlCreatePic(@ScriptDir & "\logo4.gif", 0, 136, 169, 68) ControlSetTrans(-1, 50) _WinAPI_SetLayeredWindowAttributes($hGUI, 0x0000F4) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Pic1, $Pic2, $Pic3 ConsoleWrite("Click" & @CR) EndSwitch WEnd Func ControlSetTrans($iCtrlID, $iTrans = 255, $iDisable = 0) ; original by ChrisL - edited by Johnmcloud Local $pHwnd, $hWnd, $aPos $hControl = GUICtrlGetHandle($iCtrlID) If $hControl = 0 Then Return SetError(1, 0, 0) If $iDisable Then GUICtrlSetState($iCtrlID, $GUI_DISABLE) $pHwnd = _WinAPI_GetParent($hControl) If @error Then Return SetError(2, 0, 0) $aPos = ControlGetPos($pHwnd, "", $hControl) If @error Then Return SetError(3, 0, 0) $hWnd = GUICreate("", $aPos[2], $aPos[3], $aPos[0], $aPos[1], $WS_POPUP, BitOR($WS_SYSMENU, $WS_EX_MDICHILD), $pHwnd) _WinAPI_SetParent($hControl, $hWnd) If @error Then Return SetError(4, 0, 0) ControlMove($hWnd, "", $hControl, 0, 0) WinSetTrans($hWnd, "", $iTrans) GUISetState(@SW_SHOW, $hWnd) GUISwitch($pHwnd) Return $hWnd EndFunc ;==>ControlSetTrans logo4.gif logo4.gif Perfect! Link to comment Share on other sites More sharing options...
GraaF1337 Posted October 30, 2014 Author Share Posted October 30, 2014 (edited) Or not! :-/ If you at some point do GUISetState(@SW_HIDE) The transparrent area will still show. Edited October 30, 2014 by GraaF1337 Link to comment Share on other sites More sharing options...
GraaF1337 Posted October 30, 2014 Author Share Posted October 30, 2014 (edited) Also it seems you can't use buttons if you use the transparrent thingy.. expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> $hGUI = GUICreate("New GUI", 300, 200, -1, -1, -1, $WS_EX_LAYERED) GUISetBkColor(0x0000F4) $Pic1 = GUICtrlCreatePic(@ScriptDir & "\test2.bmp", 0, 0, 300, 200) GUICtrlSetState($Pic1, $GUI_DISABLE) ControlSetTrans(-1, 175) _WinAPI_SetLayeredWindowAttributes($hGUI, 0x0000F4) GUISetState(@SW_SHOW) $test = GUICtrlCreateButton("Hide", 100, 50) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $test MsgBox(0, "HA", "HA") EndSwitch WEnd Func ControlSetTrans($iCtrlID, $iTrans = 255, $iDisable = 0) Local $pHwnd, $hWnd, $aPos $hControl = GUICtrlGetHandle($iCtrlID) If $hControl = 0 Then Return SetError(1, 0, 0) If $iDisable Then GUICtrlSetState($iCtrlID, $GUI_DISABLE) $pHwnd = _WinAPI_GetParent($hControl) If @error Then Return SetError(2, 0, 0) $aPos = ControlGetPos($pHwnd, "", $hControl) If @error Then Return SetError(3, 0, 0) $hWnd = GUICreate("", $aPos[2], $aPos[3], $aPos[0], $aPos[1], $WS_POPUP, BitOR($WS_SYSMENU, $WS_EX_MDICHILD), $pHwnd) _WinAPI_SetParent($hControl, $hWnd) If @error Then Return SetError(4, 0, 0) ControlMove($hWnd, "", $hControl, 0, 0) WinSetTrans($hWnd, "", $iTrans) GUISetState(@SW_SHOW, $hWnd) GUISwitch($pHwnd) Return $hWnd EndFunc Also i tried what was posted here. Have a look at this >link And that doesn't work either :-/ That is not even getting transparrent. Edited October 30, 2014 by GraaF1337 Link to comment Share on other sites More sharing options...
johnmcloud Posted October 30, 2014 Share Posted October 30, 2014 (edited) See post #3 Please next time don't quote the CODE tag, is unnecessary. If is solved, press the apposite button Edited October 31, 2014 by johnmcloud Link to comment Share on other sites More sharing options...
GraaF1337 Posted October 31, 2014 Author Share Posted October 31, 2014 (edited) See post #3 If you at some point do GUISetState(@SW_HIDE) The transparrent area will still show. Read please, cuz you function does what i want it to, but it keeps showing after do a "GUISetState(@SW_HIDE)" Edited October 31, 2014 by GraaF1337 Link to comment Share on other sites More sharing options...
johnmcloud Posted October 31, 2014 Share Posted October 31, 2014 You need to hide also $hChild, check the new example with $GUI_EVENT_MINIMIZE Link to comment Share on other sites More sharing options...
GraaF1337 Posted October 31, 2014 Author Share Posted October 31, 2014 I see thank you for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now