Jump to content

Please tell me reason! Thanks!


taotao878
 Share

Recommended Posts

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_.bmp

Back.bmp

Link to comment
Share on other sites

from the help file

The 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

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.
Link to comment
Share on other sites

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 transparency

the $WS_POPUP did this and I'me making a few test on other styles

if 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

I am not wearing my glasses.

Well !!, looks like I was doing that !!!

Edited 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

if u remove the $WS_POPUP it doesn't becomes trans

Not 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:

Posted Image

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.

Link to comment
Share on other sites

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

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 by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...