taotao878 Posted December 25, 2007 Share Posted December 25, 2007 The black color turn into transparent. Why? #include <GUIConstants.au3> $Form1=GUICreate("", 220, 220, -1, -1, $WS_POPUP) WinSetTrans($Form1, "", 0) GUICtrlCreatePic("back.bmp", 0, 0, 220, 220) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Endswitch WEnd__26410___21629___21517_.bmpBack.bmp Link to comment Share on other sites More sharing options...
therks Posted December 25, 2007 Share Posted December 25, 2007 Looks like a bug to me. Only happens if you use WinSetTrans before GUISetState, eh? My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
star2 Posted December 25, 2007 Share Posted December 25, 2007 from the help fileThe left-top pixel will be used as the transparency color.just make the top let pixel any color except black like the one I attached to you try it [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
therks Posted December 25, 2007 Share Posted December 25, 2007 That sentence was taken out of context.To have a transparent picture it is needed to create the GUI window with WS_EX_LAYERED extended style. The left-top pixel will be used as the transparency color. If several pictures are created the last picture is defining the transparent color.Do you see WS_EX_LAYERED in his example code? I do not but I am not wearing my glasses. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
star2 Posted December 25, 2007 Share Posted December 25, 2007 That sentence was taken out of context.Do you see WS_EX_LAYERED in his example code? I do not but I am not wearing my glasses.well you're right on that, not only the WS_EX_LAYERED will make the transparencythe $WS_POPUP did this and I'me making a few test on other stylesif u remove the $WS_POPUP it doesn't becomes trans [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
star2 Posted December 25, 2007 Share Posted December 25, 2007 (edited) I am not wearing my glasses.Well !!, looks like I was doing that !!! Edited December 25, 2007 by star2 [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
therks Posted December 25, 2007 Share Posted December 25, 2007 if u remove the $WS_POPUP it doesn't becomes transNot true for me. Used this code:#include <GUIConstants.au3> $Form1=GUICreate("", 220, 220) WinSetTrans($Form1, "", 0) GUICtrlCreatePic("back.bmp", 0, 0, 220, 220) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Endswitch WEnd And got this: Notice, even the caption buttons (close, minimize) are transparent. Just to note; Your solution will work in the short term star2, but it is still what I would consider a bug. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
star2 Posted December 25, 2007 Share Posted December 25, 2007 WinSetTrans($Form1, "", 0) Just to note; Your solution will work in the short term star2, but it is still what I would consider a bug. that's right I forgot that I have removed the (winsetTrans) [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
Siao Posted December 25, 2007 Share Posted December 25, 2007 (edited) Do you see WS_EX_LAYERED in his example code? I do not but I am not wearing my glasses.Just because you don't see something with naked eye (or even with glasses), doesn't mean it isn't there To achieve transparency, window must have layered property. On API level the transparency is set with SetLayeredWindowAttributes() or UpdateLayeredWindow().WinSetTrans does it for you. You can see for yourself with AutoIt Info tool, check window Ex. Style of that example GUI.Not sure why exactly OP needs to set window transparency, but if you don't want that see through image with transparent color, and just want your usual translucent window, set WinSetTrans after GUICtrlCreatePic, not before. Edited December 25, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
therks Posted December 25, 2007 Share Posted December 25, 2007 Just because you don't see something with naked eye (or even with glasses), doesn't mean it isn't there To achieve transparency, window must have layered property. On API level the transparency is set with SetLayeredWindowAttributes() or UpdateLayeredWindow().WinSetTrans does it for you. You can see for yourself with AutoIt Info tool, check window Ex. Style of that example GUI.Not sure why exactly OP needs to set window transparency, but if you don't want that see through image with transparent color, and just want your usual translucent window, set WinSetTrans after GUICtrlCreatePic, not before.Still seems weird that it works fine after the pic creation, but thanks for the explanation. My AutoIt Stuff | My Github 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