I made a function for creating transparent controls but martin below had a better way of doing it. (Thanks for the help martin!)
The syntax is $hWnd = _GuiCtrlMakeTrans($ControlID as returned by GuiCtrlCreate....,[Transparency level (Optional can be set later by the returned hWnd )])
Returns a handle to the new Child gui
There are a couple of functions which I can't get to work properly, one is UP/Down controls and the other is Radio Buttons
This is the new function
Func _GuiCtrlMakeTrans($iCtrlID,$iTrans=255) Local $pHwnd, $nHwnd, $aPos, $a $hWnd = GUICtrlGetHandle($iCtrlID);Get the control handle If $hWnd = 0 then Return SetError(1,1,0) $pHwnd = DllCall("User32.dll", "hwnd", "GetParent", "hwnd", $hWnd);Get the parent Gui Handle If $pHwnd[0] = 0 then Return SetError(1,2,0) $aPos = ControlGetPos($pHwnd[0],"",$hWnd);Get the current pos of the control If @error then Return SetError(1,3,0) $nHwnd = GUICreate("", $aPos[2], $aPos[3], $aPos[0], $aPos[1], 0x80000000, 0x00080000 + 0x00000040, $pHwnd[0]);greate a gui in the position of the control If $nHwnd = 0 then Return SetError(1,4,0) $a = DllCall("User32.dll", "hwnd", "SetParent", "hwnd", $hWnd, "hwnd", $nHwnd);change the parent of the control to the new gui If $a[0] = 0 then Return SetError(1,5,0) If NOT ControlMove($nHwnd,'',$hWnd,0,0) then Return SetError(1,6,-1);Move the control to 0,0 of the newly created child gui GUISetState(@SW_Show,$nHwnd);show the new child gui WinSetTrans($nHwnd,"",$iTrans);set the transparency If @error then Return SetError(1,7,0) GUISwitch($pHwnd[0]);switch back to the parent Gui Return $nHwnd;Return the handle for the new Child gui EndFunc
Here is an example of the Help file Gui Example
#include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> ; GUI GuiCreate("Sample GUI", 400, 400) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) GUICtrlCreatePic(@WindowsDir & "\River Sumida.bmp",0,0,400,400,$WS_CLIPSIBLINGS) ; MENU GuiCtrlCreateMenu("Menu&One") GuiCtrlCreateMenu("Menu&Two") GuiCtrlCreateMenu("MenuTh&ree") GuiCtrlCreateMenu("Menu&Four") ; CONTEXT MENU $contextMenu = GuiCtrlCreateContextMenu() GuiCtrlCreateMenuItem("Context Menu", $contextMenu) GuiCtrlCreateMenuItem("", $contextMenu);separator GuiCtrlCreateMenuItem("&Properties", $contextMenu) ; PIC Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\logo4.gif" GuiCtrlCreatePic($sFile,0,20, 169,68) $pt = _GuiCtrlMakeTrans(-1); we'll set the transparecy later for this one GuiCtrlCreateLabel("Sample pic", 75, 21, 53, 15) GuiCtrlSetColor(-1,0xffffff) _GuiCtrlMakeTrans(-1,100) ; AVI Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\sampleAVI.avi" GuiCtrlCreateAvi($sFile,0, 180, 30, 32, 32, $ACS_AUTOPLAY) _GuiCtrlMakeTrans(-1,100) GuiCtrlCreateLabel("Sample avi", 170, 70) _GuiCtrlMakeTrans(-1,100) ; TAB GuiCtrlCreateTab(240, 20, 150, 70) _GuiCtrlMakeTrans(-1,100) GuiCtrlCreateTabItem("One") GuiCtrlCreateLabel("Sample Tab with tabItems", 250, 40) GuiCtrlCreateTabItem("Two") GuiCtrlCreateTabItem("Three") GuiCtrlCreateTabItem("") ; COMBO GuiCtrlCreatecombo("Sample Combo", 250, 100, 120, 100) _GuiCtrlMakeTrans(-1,100) ; PROGRESS GuiCtrlCreateProgress(60, 100, 150, 20) GuiCtrlSetData(-1, 60) _GuiCtrlMakeTrans(-1,100) GuiCtrlCreateLabel("Progress:", 5, 102) _GuiCtrlMakeTrans(-1,100) ; EDIT GuiCtrlCreateEdit(@CRLF & " Sample Edit Control", 10, 130, 150, 70) _GuiCtrlMakeTrans(-1,100) ; LIST GuiCtrlCreateList("", 5, 210, 100, 90) _GuiCtrlMakeTrans(-1,100) GuiCtrlSetData(-1, "a.Sample|b.List|c.Control|d.Here", "b.List") ; ICON GuiCtrlCreateIcon("shell32.dll", 1, 175, 140) _GuiCtrlMakeTrans(-1,100) GuiCtrlCreateLabel("Icon", 180, 180, 50, 20) _GuiCtrlMakeTrans(-1,100) ; LIST VIEW $listView = GuiCtrlCreateListView("Sample|ListView|", 110, 210, 110, 80) _GuiCtrlMakeTrans(-1,100) GuiCtrlCreateListViewItem("A|One", $listView) GuiCtrlCreateListViewItem("B|Two", $listView) GuiCtrlCreateListViewItem("C|Three", $listView) ; UPDOWN GuiCtrlCreateLabel("UpDown", 350, 135) _GuiCtrlMakeTrans(-1,100) GuiCtrlCreateInput("42", 350, 140, 40, 20) GuiCtrlCreateUpDown(-1) ; GROUP WITH RADIO BUTTONS GuiCtrlCreateGroup("Sample Group", 230, 120,110,80) GuiCtrlCreateRadio("Radio One", 250, 140, 80) GuiCtrlSetState(-1, $GUI_CHECKED) GuiCtrlCreateRadio("Radio Two", 250, 165, 80) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group ; LABEL GuiCtrlCreateLabel("Green" & @CRLF & "Label", 350, 185, 40, 40) GuiCtrlSetBkColor(-1, 0x00FF00) _GuiCtrlMakeTrans(-1,100) ; SLIDER GuiCtrlCreateLabel("Slider:", 235, 235) _GuiCtrlMakeTrans(-1,100) GuiCtrlCreateSlider(270, 230, 120, 30) _GuiCtrlMakeTrans(-1,100) GuiCtrlSetData(-1, 30) ; INPUT GuiCtrlCreateInput("Sample Input Box", 235, 275, 130, 20) _GuiCtrlMakeTrans(-1,100) ; DATE GuiCtrlCreateDate("", 5, 300, 200, 20) _GuiCtrlMakeTrans(-1,100) GuiCtrlCreateLabel("(Date control expands into a calendar)", 10, 325, 200, 20) _GuiCtrlMakeTrans(-1,100) ; BUTTON $Button = GuiCtrlCreateButton("Sample Button", 10, 350, 100, 30) _GuiCtrlMakeTrans(-1,100) ; CHECKBOX GuiCtrlCreateCheckbox("Checkbox", 130, 355, 80, 20) GuiCtrlSetState(-1, $GUI_CHECKED) _GuiCtrlMakeTrans(-1,100) ; TREEVIEW ONE $treeOne = GuiCtrlCreateTreeView(210, 310, 80, 80) _GuiCtrlMakeTrans(-1,100) $treeItem = GuiCtrlCreateTreeViewItem("TreeView", $treeOne) GuiCtrlCreateTreeViewItem("Item1", $treeItem) GuiCtrlCreateTreeViewItem("Item2", $treeItem) GuiCtrlCreateTreeViewItem("Foo", -1) GuiCtrlSetState($treeItem, $GUI_EXPAND) ; TREEVIEW TWO $treeTwo = GuiCtrlCreateTreeView(295, 310, 103, 80, $TVS_CHECKBOXES) _GuiCtrlMakeTrans(-1,100) GuiCtrlCreateTreeViewItem("TreeView", $treeTwo) GuiCtrlCreateTreeViewItem("With", $treeTwo) GuiCtrlCreateTreeViewItem("tvs_checkboxes", $treeTwo) GuiCtrlSetState(-1, $GUI_CHECKED) GuiCtrlCreateTreeViewItem("Style", $treeTwo) ; GUI MESSAGE LOOP GuiSetState() ;change the transparency of the picture For $i = 255 to 0 step -1 WinSetTrans($pt,"",$i) Sleep(1) Next For $i = 0 to 100 WinSetTrans($pt,"",$i) Sleep(1) Next While 1 Switch GuiGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button Msgbox(0,"","Button still works!") EndSwitch WEnd Func _GuiCtrlMakeTrans($iCtrlID,$iTrans=255) Local $pHwnd, $nHwnd, $aPos, $a $hWnd = GUICtrlGetHandle($iCtrlID);Get the control handle If $hWnd = 0 then Return SetError(1,1,0) $pHwnd = DllCall("User32.dll", "hwnd", "GetParent", "hwnd", $hWnd);Get the parent Gui Handle If $pHwnd[0] = 0 then Return SetError(1,2,0) $aPos = ControlGetPos($pHwnd[0],"",$hWnd);Get the current pos of the control If @error then Return SetError(1,3,0) $nHwnd = GUICreate("", $aPos[2], $aPos[3], $aPos[0], $aPos[1], 0x80000000, 0x00080000 + 0x00000040, $pHwnd[0]);greate a gui in the position of the control If $nHwnd = 0 then Return SetError(1,4,0) $a = DllCall("User32.dll", "hwnd", "SetParent", "hwnd", $hWnd, "hwnd", $nHwnd);change the parent of the control to the new gui If $a[0] = 0 then Return SetError(1,5,0) If NOT ControlMove($nHwnd,'',$hWnd,0,0) then Return SetError(1,6,-1);Move the control to 0,0 of the newly created child gui GUISetState(@SW_Show,$nHwnd);show the new child gui WinSetTrans($nHwnd,"",$iTrans);set the transparency If @error then Return SetError(1,7,0) GUISwitch($pHwnd[0]);switch back to the parent Gui Return $nHwnd;Return the handle for the new Child gui EndFunc
Edited by ChrisL, 09 June 2008 - 06:34 AM.








