Page 1 of 1

Picture Control Order

Posted: 29 Aug 2022, 12:27
by TheDewd
I'm attempting to layer Picture controls.

First, I add a Picture control with a specific background color, then I add another Picture control containing an image with transparent background -- however the z-order is not what I was expecting and this will not work.

I don't understand why I have to add the Picture controls in reverse order. The Picture control responsible for background color must be added AFTER the Picture control which is loading the picture file.

If I add the control for background color first, it ends up at the top-most layer which covers up the picture from the image file.

I hope that makes sense.

I learned that I can change the order using a command, but I'd like to understand more about why this happens.
WinSet, Bottom,, % "ahk_id" hNavbarBg

Code: Select all

hBM2D2E31 := DllCall("Gdi32.dll\CreateBitmap", "Int", 1, "Int", 1, "Int", 0x1, "Int", 32, "Ptr*", 0x2D2E31, "Ptr")
Gui, Add, Picture, x0 y0 w48 h48 +BackgroundTrans, img/baseline_menu_white_24dp.png
Gui, Add, Picture, x0 y0 w640 h48 +HWNDhNavbarBg, % "HBITMAP:* " hBM2D2E31

Re: Picture Control Order

Posted: 29 Aug 2022, 15:38
by wetware05
TheDewd, why try to change the order of the layers and not just adapt to how autohotkey works? The first layer of the gui, the one that will read or interpret autohotkey first, will be the one that is furthest to the bottom.