Marklar Posted May 30, 2005 Posted May 30, 2005 #include <GUIConstants.au3> $MainWin=GUICreate("Select a Task",442,400,-1,-1,-1,$WS_EX_LAYERED) $Logo=GUICtrlCreatePic("imgs\logo.gif",115,50, 230,75) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd I have the image set to be transparent. It works in HTML pages and all that good stuff. Now, how do I get it to work in AutoIT? I read the Help file and it says to set at as $WS_EX_LAYERED.... Which I did. But I can see straight through and onto my desktop. Any help would be appreciated Thanks
FuryCell Posted May 30, 2005 Posted May 30, 2005 (edited) #include <GUIConstants.au3> $MainWin=GUICreate("Select a Task",442,400,-1,-1,-1,$WS_EX_LAYERED) $Logo=GUICtrlCreatePic("imgs\logo.gif",115,50, 230,75) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEndI have the image set to be transparent. It works in HTML pages and all that good stuff. Now, how do I get it to work in AutoIT? I read the Help file and it says to set at as $WS_EX_LAYERED.... Which I did. But I can see straight through and onto my desktop.Any help would be appreciatedThanks<{POST_SNAPBACK}>i think you need the latest beta. Edited May 30, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Marklar Posted May 30, 2005 Author Posted May 30, 2005 (edited) nope... Same result and if I take out the EX_Layered thing then the image has a black background with no transparency at all Edited May 30, 2005 by Marklar
layer Posted May 30, 2005 Posted May 30, 2005 this will be of no help at all... but, it doesn't look like you need to even declare the variables $MainWin and $Logo unless you're not done with your script yet FootbaG
Marklar Posted May 30, 2005 Author Posted May 30, 2005 this will be of no help at all... but, it doesn't look like you need to even declare the variables $MainWin and $Logo unless you're not done with your script yet <{POST_SNAPBACK}>lol i know.... but its good practice
Helge Posted May 30, 2005 Posted May 30, 2005 Try to specify the full path to the image-file. Like this : $Logo=GUICtrlCreatePic(@ScriptDir & "\imgs\logo.gif",115,50, 230,75) That should work.
therks Posted May 30, 2005 Posted May 30, 2005 It doesn't work. Period. Transparency in images is not supported, except as a transparent mask for the entire GUI. Your option is thus: Have one GUI with just the image, transparency and everything, just like you have it now, GUI(1). Then have another GUI with whatever you want in the background, GUI(2). Have GUI(1) be a child of GUI(2). If you're using the latest beta, you can find example code at "*AutoIt Folder*\tests\gui\pic transparent on pic.au3" My AutoIt Stuff | My Github
Helge Posted May 30, 2005 Posted May 30, 2005 Well that was strange, because I replaced Marklar's line with the line I posted above,and it worked...! As far as I remember, the only other thing I added was theGUI-style $WS_POPUP. As I've moved my ass a couple of hundred meters away from where I was half anhour ago, and to a Macintosh, I'm unable to give you the test right now.... Later.(If I remember correctly I think I tested something like this, when I was back homelast week, on my own computer running WinXP, and it failed. When tested today it wasrunning on Win2000... It probably has nothing do with it, though.)It doesn't work. Period. Transparency in images is not supported, except as a transparent mask for the entire GUI.Your option is thus: Have one GUI with just the image, transparency and everything, just like you have it now, GUI(1). Then have another GUI with whatever you want in the background, GUI(2). Have GUI(1) be a child of GUI(2).If you're using the latest beta, you can find example code at "*AutoIt Folder*\tests\gui\pic transparent on pic.au3"<{POST_SNAPBACK}>
therks Posted May 30, 2005 Posted May 30, 2005 Well that was strange, because I replaced Marklar's line with the line I posted above,and it worked...! As far as I remember, the only other thing I added was theGUI-style $WS_POPUP. As I've moved my ass a couple of hundred meters away from where I was half anhour ago, and to a Macintosh, I'm unable to give you the test right now.... Later.(If I remember correctly I think I tested something like this, when I was back homelast week, on my own computer running WinXP, and it failed. When tested today it wasrunning on Win2000... It probably has nothing do with it, though.)<{POST_SNAPBACK}>I think maybe we are just misunderstanding eachother, or the original poster.What I understood from the original post, was that Marklar wanted to put an image on his GUI, and have the colour he designated as transparent appear transparent, ON the GUI window. Not unlike this image here:Notice how you can see the forum background colour around the image. But if you were to load this image into an editor, you'd see that the background colour is bright green.Also, if you attempt to load this image into a GUI, you will see the bright green background colour. You can however supply $WS_EX_LAYERED to the GUICreate, which makes the GUI itself transparent, hence his comment about being able to see his desktop through the GUI. But I don't think that's what he wants.If you look at this image:Ex. 1 is without using $WS_EX_LAYEREDEx. 2 is with using $WS_EX_LAYERED (that's your avatar in the background Helge )Ex. 3 is the one that I believe is currently impossible but is also what Marklar is after. My AutoIt Stuff | My Github
Marklar Posted May 30, 2005 Author Posted May 30, 2005 It doesn't work. Period. Transparency in images is not supported, except as a transparent mask for the entire GUI.Your option is thus: Have one GUI with just the image, transparency and everything, just like you have it now, GUI(1). Then have another GUI with whatever you want in the background, GUI(2). Have GUI(1) be a child of GUI(2).If you're using the latest beta, you can find example code at "*AutoIt Folder*\tests\gui\pic transparent on pic.au3"Okay this works. ThanksUnfortunately it wont help me for my current project because I am using multiple tabs and each tab takes up the whole window... Depending where I place the popup gui the tabs wont show up. Then if I can get the tabs to show up the logo (which is supposed to only show on the first tab) will show up on every other tab.. I tried a @SW_HIDE but only found problems.It may be possible, but I'll just have to mess with it. Until then I'll probably have to wait until gif is supported (please )
therks Posted May 30, 2005 Posted May 30, 2005 (edited) If you're using tabs, then Holger wrote some good example code that shows how to use tabs/child GUIs.Lemme find it here...*Edit: Found it. Maybe this will provide some help. Edited May 30, 2005 by Saunders My AutoIt Stuff | My Github
jpm Posted May 30, 2005 Posted May 30, 2005 #include <GUIConstants.au3> $gui=GUICreate("test", 150, 150) GUISetBkColor(0x00ffff) GUISetState(@SW_SHOW) $pic=GUICreate("", 44, 80, 50, 50,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) $Logo = GUICtrlCreatePic ("transparent.gif", 0, 0,0,0) GUISetState() do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE What do you think?
Marklar Posted May 30, 2005 Author Posted May 30, 2005 If you're using tabs, then Holger wrote some good example code that shows how to use tabs/child GUIs.Lemme find it here...*Edit: Found it. Maybe this will provide some help.<{POST_SNAPBACK}>Wow.. When i try to adapt that to what i need i get overwhelmed. I've got child windows on top of child windows... Heh.. im gonna have to look at that one for a whileBut you wanna know whats really weird. This attached file works. Its transparent just the way I want it and what is apparently impossible. Yet this works? And its only with this BMP file.. Thats right its not even a gif fileAnd here is the code#include <GuiConstants.au3> GuiCreate("What the ???", 200, 200,200,250,-1) GUICtrlCreatePic("ie.bmp",65,50,0,0) GUICtrlCreateLabel("It only appears to work with this certain bmp file_ .... Its not even a gif???",65,105,90,90) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEndHuhWhat.zip
Marklar Posted May 30, 2005 Author Posted May 30, 2005 (edited) Update: The above attachment seems to only work on Windows XP not Windows 98. Edited May 30, 2005 by Marklar
therks Posted May 30, 2005 Posted May 30, 2005 @Marklar: Wow.. that really is odd...@jpm: Yeah, that's basically the same method used in "pic transparent on pic.au3" in the tests folder. But here's a question, do you know of a way to have it so that the child window is restricted to within the parent? Like the Yum example here? My AutoIt Stuff | My Github
jpm Posted May 31, 2005 Posted May 31, 2005 Yes and no you have to compute the position of thechild window to stay in the parent area. No automatic process. You can handle the $GUI_EVENT_RESIZED special event and use GuiCtrlSetPos on the child window. Good computation
Helge Posted May 31, 2005 Posted May 31, 2005 @Saunders :Oooh, of course.Man, I have to stop posting so late at night..(/early in the morning)..
bob.frew Posted September 6, 2005 Posted September 6, 2005 This may help as a workaround.I set a background colour for the window using GUISetBkColorThen using your favourite program change your image to set the layer that you want to end up as transparent to be the same colour as the window background.I know it's not pretty, but it works. AutoIt is great - leave me alone and I'll play for hours
andd Posted September 7, 2005 Posted September 7, 2005 Hm, the *.AVI-files from, for example the shell32.dll, can be used with transparence (at least at a common gray window). Maybe you should convert your *.gif in a "one-frame-avi" ...
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