aiter Posted May 16, 2018 Posted May 16, 2018 (edited) I am trying to get an image showing through a edit box. I am only successful in making the edit box totally transparent #include-once #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISys.au3> #include <colorconstants.au3> ;WS_EX_TRANSPARENT $gui = GUICreate("", 1000, 800, -1, -1, -1 , $WS_EX_LAYERED) ; use layered to get _winapi_setlay... to work $pic = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif", 0,0,1000, 800) GUICtrlSetState(-1, $GUI_DISABLE) $edit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32,200,600) GUICtrlSetBkColor(-1,$COLOR_YELLOW) _WinAPI_SetLayeredWindowAttributes($gui,$COLOR_YELLOW,199) ; 199 is alpha (transparency level) GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit Func Terminate() exit(0) EndFunc So I am making the edit box's background yellow then using the _WINAPI_SetLayeredWIndowAttributes command to make the yellow disappear (which it does), but the alpha level is supposed to give a bit of opaqueness to it, but its not, just making it totally transparent. The alpha level is in fact affecting the window itself and not the edit box. I only want the edit box to be partially transparent. Help appreciated. Edited May 16, 2018 by aiter solved
Moderators Melba23 Posted May 16, 2018 Moderators Posted May 16, 2018 aiter, I would use a child GUI like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> $hGUI = GUICreate("", 1000, 800) $cPic = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif", 0, 0, 1000, 800) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW, $hGUI) ; Create child GUI $hChild = GUICreate("", 200, 600, 176, 32, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) $cEdit = GUICtrlCreateEdit("First line" & @CRLF, 0, 0, 200, 600) GUICtrlSetBkColor(-1, $COLOR_YELLOW) ; Set child transparency WinSetTrans($hChild, "", 199) GUISetState(@SW_SHOW, $hChild) While 1 $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Exit M23 aiter 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
jguinch Posted May 16, 2018 Posted May 16, 2018 it should also work without a child GUI, using WinSetTrans with the handle of the edit): #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> $hGUI = GUICreate("", 1000, 800) $cPic = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif", 0, 0, 1000, 800) GUICtrlSetState(-1, $GUI_DISABLE) $cEdit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32, 200, 600) GUICtrlSetBkColor(-1, $COLOR_YELLOW) WinSetTrans(GUICtrlGetHandle($cEdit), "", 150) GUISetState(@SW_SHOW, $hGUI) While 1 $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Exit aiter 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Moderators Melba23 Posted May 16, 2018 Moderators Posted May 16, 2018 jguinch, That does not produce a transparent edit for me - it is still solid yellow. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
jguinch Posted May 16, 2018 Posted May 16, 2018 strange, it works for me... (Windows 10 x64) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
aiter Posted May 17, 2018 Author Posted May 17, 2018 (edited) jguinch - just tested your code on my laptop which is windows 10 64bit and your code works. Does not work on my desktop which is windows 7 64bit. The behaviour of the input box is a bit wonky - I found it losing data sent to the control and the resize of the window to max produces wonkiness as well (strange blobs on side which disappear when the edit box is clicked on). The window mdi_child also has problems with resize , but I can accomodate for that using a GUIRegisterMsg($WM_SIZE, "WM_SIZE") routine. The text is also made opaque, but I can set it to be bolder. Edited May 17, 2018 by aiter add
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