Sign in to follow this  
Followers 0
qwert

Transparency color doesn't transfer to child GUI

4 posts in this topic

I'm working with a layered GUI and trying to achieve the transparency effect for child GUIs. To explain further, I have a parent window that uses orange (0xFF8040) as the transparent color in a background image to create a window with rounded corners. That works fine.

The problem is that when I create a child GUI and try to use the same orange color in a child image, it doesn't render as transparent. Here is an excerpt from the documentation.

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.

After experimenting for an entire day, I've just about concluded that I'm trying to push the use too far -- that the transparency color doesn't apply to a child GUI. But is that correct? Can anyone confirm this is so?

Thanks for any assistance.

Share this post


Link to post
Share on other sites



I'm working with a layered GUI and trying to achieve the transparency effect for child GUIs. To explain further, I have a parent window that uses orange (0xFF8040) as the transparent color in a background image to create a window with rounded corners. That works fine.

The problem is that when I create a child GUI and try to use the same orange color in a child image, it doesn't render as transparent. Here is an excerpt from the documentation.

After experimenting for an entire day, I've just about concluded that I'm trying to push the use too far -- that the transparency color doesn't apply to a child GUI. But is that correct? Can anyone confirm this is so?

Thanks for any assistance.

I assume you are trying to set the extended style of the child window to be $WS_EX_LAYERED, but you should have looked that up before posting.

$WS_EX_LAYERED 0x00080000 Creates a layered window. Note that this cannot be used for child windows.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

$WS_EX_LAYERED ... this cannot be used for child windows.

Yes, I had seen that in the documentation -- so I use it only for the parent GUI. The basis for my question in this post came from my earlier post about overlay images (link). My searches (here and in MSDN) haven't turned up anything that specifically addresses the transparent pixel technique for child windows -- although there are several topics on the 0-255 transparency effect, which is not what I need.

Maybe my question for this post should have been simply: Is there any way to invoke the transparent pixel effect in a child window? Since the Layered Style cannot be used, the answer may be No -- but I've seen so many innovative "workaround" techniques posted on these forums that I haven't yet given up hope.

Thanks for taking a look at this.

Share this post


Link to post
Share on other sites

Yes, I had seen that in the documentation -- so I use it only for the parent GUI. The basis for my question in this post came from my earlier post about overlay images (link). My searches (here and in MSDN) haven't turned up anything that specifically addresses the transparent pixel technique for child windows -- although there are several topics on the 0-255 transparency effect, which is not what I need.

Maybe my question for this post should have been simply: Is there any way to invoke the transparent pixel effect in a child window? Since the Layered Style cannot be used, the answer may be No -- but I've seen so many innovative "workaround" techniques posted on these forums that I haven't yet given up hope.

Thanks for taking a look at this.

I was thinking in very straight lines; I should have thought more about what you wanted than what you had done.

Here is an example which I think was taken from a post by Siao. Maybe it helps.

#include <GuiConstantsEx.au3>
#include <windowsconstants.au3>

Const $WS_EX_COMPOSITED = 0x2000000

$Main_GUI = GUICreate("Main",500,500,-1,-1, $WS_EX_TRANSPARENT,$WS_EX_COMPOSITED)
;~ GUISetBkColor(0xffffff)
$Btn_Exit = GUICtrlCreateButton("E&xit", 10, 10, 90, 20)
GUICtrlCreateLabel("aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa",200,80,50,50, -1,$WS_EX_TRANSPARENT)
GUIctrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW, $Main_GUI)
$Child_GUI = GUICreate("Child", 100, 100, 10, 50, $WS_CHILD, BitOR($WS_EX_TRANSPARENT,$WS_EX_TOPMOST), $Main_GUI)
;~ GUISetBkColor(0xffffff)
$label=GUICtrlCreateLabel("bbbbbbbbbbbbbbb bbbbbbbbbb bbbbbbbbbbbbb bbbbbbbb",5,5,50,50, -1,-1)
GUIctrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
$Btn_Test = GUICtrlCreateButton("Test", 10, 10, 90, 20)
GUISetState(@SW_SHOW, $Child_GUI)
$i=10
WinSetState($Main_GUI,"",$GUI_HIDE)
While 1
    $i+=1
    $msg=GUIGetMsg()
    If $msg=$GUI_EVENT_CLOSE Or $msg=$Btn_Exit Then Exit
    If $msg=$Btn_Test Then MsgBox(0, "Test", "Hit Button on Child Window")
    WinMove($Child_GUI,"",$i,50)
WEnd

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  
Followers 0