GraaF1337 Posted October 13, 2014 Posted October 13, 2014 (edited) Im looking for a way to make the background transparent, but keep the graphic fully visible. My GUI: 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) 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) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I tried this so far, but that dont even work :-/ $Form1 = GUICreate("Form1", 200, 200, 663, 317) GUISetState(@SW_SHOW) _WinAPI_SetLayeredWindowAttributes($Form1, 0x0000F4, 255) Also tried with "WinSetTrans" But that makes everything transparent :-/ $Form1 = GUICreate("Form1", 200, 200, 663, 317) GUISetState(@SW_SHOW) WinSetTrans($Form1, "", 70) Also just tried this: $Form1 = GUICreate("Form1", 200, 200, 663, 317) $bk = GUICtrlSetBkColor($form1, 0x000000) WinSetTrans($bk, "", 70) Also: $Form1 = GUICreate("Form1", 200, 200, 663, 317) $bk = GUISetBkColor($COLOR_RED) WinSetTrans($bk, "", 70) Nothing i tried so far have worked. Edited October 13, 2014 by GraaF1337
mikell Posted October 13, 2014 Posted October 13, 2014 $Form1 = GUICreate("Form1", 200, 200, 663, 317, -1, $WS_EX_LAYERED) GUISetBkColor(0x0000F4) _WinAPI_SetLayeredWindowAttributes($Form1, 0x0000F4)
GraaF1337 Posted October 13, 2014 Author Posted October 13, 2014 (edited) $Form1 = GUICreate("Form1", 200, 200, 663, 317, -1, $WS_EX_LAYERED) GUISetBkColor(0x0000F4) _WinAPI_SetLayeredWindowAttributes($Form1, 0x0000F4) That got my this result: o.O The blue part is supose to be transparent Edited October 13, 2014 by GraaF1337
jguinch Posted October 13, 2014 Posted October 13, 2014 Mikell's code works for me. #Include <WindowsConstants.au3> #Include <WinAPI.au3> $Form1 = GUICreate("Form1", 200, 200, 663, 317, -1, $WS_EX_LAYERED) GUISetBkColor(0x0000F4) _WinAPI_SetLayeredWindowAttributes($Form1, 0x0000F4) GUISetState() Do Sleep(10) Until GUIGetMsg() = -3 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
GraaF1337 Posted October 13, 2014 Author Posted October 13, 2014 Mikell's code works for me. #Include <WindowsConstants.au3> #Include <WinAPI.au3> $Form1 = GUICreate("Form1", 200, 200, 663, 317, -1, $WS_EX_LAYERED) GUISetBkColor(0x0000F4) _WinAPI_SetLayeredWindowAttributes($Form1, 0x0000F4) GUISetState() Do Sleep(10) Until GUIGetMsg() = -3 Yea, i figured out why it didn't for me.. :-/ If you add a picture somewhere in the GUI all of the transparent will become blue. 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) _WinAPI_SetLayeredWindowAttributes($Form1, 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) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
mikell Posted October 13, 2014 Posted October 13, 2014 Oh yes I see Put the _WinAPI_SetLayeredWindowAttributes down just before the GuiSetState
GraaF1337 Posted October 13, 2014 Author Posted October 13, 2014 Oh yes I see Put the _WinAPI_SetLayeredWindowAttributes down just before the GuiSetState That works like a charm! Thank you!
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