ludocus Posted June 27, 2008 Share Posted June 27, 2008 (edited) is it possible to set the window trans except for the controls.. so all the controls are sharp but the window has a trans.. how could I do that? Edited June 27, 2008 by ludocus Link to comment Share on other sites More sharing options...
FreeFry Posted June 27, 2008 Share Posted June 27, 2008 Hmm, I can't think of a "real" way to do it, but perhaps you could create your "main" gui, set trans on it, then create a new gui, with no title bar, and WS_POPUP as style, and making it a child window to your main gui(so it's just a square with nothing in it, and so it moves with it), then add a button to that gui(with the size of the gui).. Uhm.. that's probably kinda hard to understand, but I cba. to make an example atm.. Link to comment Share on other sites More sharing options...
Kip Posted June 27, 2008 Share Posted June 27, 2008 (edited) set window trans accept for the controls..,Do you mean "except"? You can make a gui with $WS_POPUP and $WS_EX_LAYERED. Create a Pic (the same size as the gui), and load bitmap containing just one color. Then create you controls on the gui. This will create a totally transparant gui with just the control 100% visible.Just put a another gui behind it. Edited June 27, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
martin Posted June 27, 2008 Share Posted June 27, 2008 is it possible to set the window trans accept for the controls..so all the controls are sharp but the window has a trans..how could I do that?Have a look at this thread in Example scripts.(You'll need to add #include <WindowsConstants.au3> to the post in the link.) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ludocus Posted June 27, 2008 Author Share Posted June 27, 2008 (edited) mhmmm.. thnx.. @Kip: yeh, I know that one.. but I don't want total transparancy.. I want a bit.. (like 150) Edited June 27, 2008 by ludocus Link to comment Share on other sites More sharing options...
Kip Posted June 27, 2008 Share Posted June 27, 2008 That's why i said: "Just put a another gui behind it." So you can set the tranparency on that window, and the controls will stay normal. (Because they're on an other GUI) MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
FreeFry Posted June 27, 2008 Share Posted June 27, 2008 Hey Kip, provide an example will ya, I'd like to see how it would look like when deployed properly, as you mean. Link to comment Share on other sites More sharing options...
Kip Posted June 27, 2008 Share Posted June 27, 2008 What I mean is this: #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> $BG_GUI = GUICreate("BG",400,400) WinSetTrans($BG_GUI,"",100) GUISetState() $CONTROL_GUI = GUICreate("Control Gui",400,400,-1,-1,$WS_POPUP,$WS_EX_LAYERED+$WS_EX_MDICHILD,$BG_GUI) GUICtrlCreatePic("grey.gif",0,0,400,400) GUICtrlCreateButton("bla",100,100,120,23) GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
FreeFry Posted June 28, 2008 Share Posted June 28, 2008 I see... But the controls do not show for me, only the background gui is shown. :| Link to comment Share on other sites More sharing options...
Kip Posted June 28, 2008 Share Posted June 28, 2008 do you have this image? MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ProgAndy Posted June 28, 2008 Share Posted June 28, 2008 You could alos use _WinAPI_SetLayeredWindowAttributes from http://www.autoitscript.com/forum/index.ph...indowattributes to set the Transparent color *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Malkey Posted June 28, 2008 Share Posted June 28, 2008 Playing around with Kip's submission and GUI Styles and exstyles, another choice for you. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Local $iWidth = 260, $iHeight = 200 $BG_GUI = GUICreate("BG", $iWidth, $iHeight, -1, 200, $WS_POPUPWINDOW, 0) WinSetTrans($BG_GUI, "", 150) GUISetState() $CONTROL_GUI = GUICreate("Control Gui", $iWidth - 5, $iHeight - 4, 0, -20, $WS_POPUPWINDOW, _ BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $BG_GUI) GUICtrlCreatePic("grey.gif", 0, 0, $iWidth, $iHeight) GUICtrlSetStyle(-1, $WS_DISABLED) $but = GUICtrlCreateButton("Button", ($iWidth - 120 - 5) / 2, ($iHeight - 23 - 4) / 2, 120, 23) GUISetState() Do $msg = GUIGetMsg() If $msg = $but Then MsgBox(0, "", "Button Pressed") Until $msg = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
Kip Posted June 28, 2008 Share Posted June 28, 2008 Script without a picture. expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WINAPI.au3> $Gui = GUICreate("Gui",300,400) WinSetTrans($Gui,"",100) GUISetState() $gui = GUICreate("trans", 300, 400, -1, -1, $WS_POPUP, $WS_EX_LAYERED+$WS_EX_MDICHILD, $gui) GUICtrlCreateLabel("This is text on a transparent Layered GUI", 10, 10, 200, 20) $layButt = GUICtrlCreateButton("Button", 10, 40, 40) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($gui, 0xABCDEF) GUISetState() While 1 WEnd Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False) If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, _WinAPI_GetLastError(), 0) Case Else Return 1 EndSelect EndFunc;==>_WinAPI_SetLayeredWindowAttributes MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Malkey Posted June 28, 2008 Share Posted June 28, 2008 Well done Kip. This definitively opens up more possible options to play with. My effort:- expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WINAPI.au3> Global Const $WM_LBUTTONDOWN = 0x0201 ; Drag Window 1 of 3 addin Local $iWidth = 260, $iHeight = 200 ;--------------------------------------- $hGui = GUICreate("BG", $iWidth, $iHeight, -1, 200, $WS_POPUPWINDOW, $WS_EX_TOPMOST ) GUISetBkColor(0xff0000) WinSetTrans($hGui, "", 50) GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove") ; Drag Window 2 of 3 addin GUISetState() ;--------------------------------------- $gui = GUICreate("Control Gui", $iWidth - 5, $iHeight - 4, 0, -20, $WS_POPUPWINDOW, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGui) GUICtrlCreateLabel("This is text on a transparent Layered GUI" & @CRLF & " Press Esc to Exit", 10, 10, 200, 50) $but = GUICtrlCreateButton("Button", ($iWidth - 120 - 5) / 2, ($iHeight - 23 - 4) / 2, 120, 23) GUICtrlSetBkColor(-1, 0xFFFF00) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($gui, 0xABCDEF) GUISetState() ;--------------------------------------- Do $msg = GUIGetMsg() If $msg = $but Then MsgBox(0, "", "Button Pressed") Until $msg = $GUI_EVENT_CLOSE ; From http://www.autoitscript.com/forum/index.php?s=&showtopic=74560&view=findpost&p=541838 Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False) If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages) Select Case @error Return SetError(@error, 0, 0) Case $Ret[0] = 0 Return SetError(4, _WinAPI_GetLastError(), 0) Case Else Return 1 EndSelect EndFunc ;==>_WinAPI_SetLayeredWindowAttributes ; ================================================================= ; Drag Window 3 of 3 addin ; ================================================================= Func _WinMove($hwnd, $Command, $wParam, $lParam) If BitAND(WinGetState($hwnd), 32) Then Return $GUI_RUNDEFMSG ;DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) DllCall("user32.dll", "int", "SendMessage", "hWnd", $hwnd, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0) Return EndFunc ;==>_WinMove 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