Yet there is a snag........ bit depth.
WindowsXP 32bit: If the image is 32bits, the Window is see-through but you can still hold left-mouse down in the transparent region and move the window without any issue (exactly what I need, perfect). If the image is 24bits, the Window is see-through but too see-through - the mouse picks whatever there is underneath the window in the transparent region.
Windows 7 (32bit exe on Win 7 64bit): Both 32bit and 24bit images are "too see-through" as described above.
Test Code:
Code: Select all
#BackBlue = 16711680 ;RGB(0,0,255)
Enumeration
#Win
#ImageGdt
#BtnExit
EndEnumeration
iFlags.i = #PB_Window_BorderLess|#PB_Window_Invisible|#PB_Window_ScreenCentered
If OpenWindow(#Win, 0, 0, 400, 400, "Transparent Win",iFlags)
SetWindowLongPtr_(WindowID(#Win), #GWL_EXSTYLE, #WS_EX_LAYERED | #WS_EX_TOPMOST)
SetLayeredWindowAttributes_(WindowID(#Win),#BackBlue,0,#LWA_COLORKEY)
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
iImage.i = CreateImage(#PB_Any, 400, 400, 32) ;<<<< Change to 24bit
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If StartDrawing(ImageOutput(iImage))
DrawingMode(#PB_2DDrawing_Default)
Box(0,0,400,400,#BackBlue)
Box(20,20,360,360,RGB(0,0,0))
Box(50,50,300,300,#BackBlue)
StopDrawing()
ImageGadget(#ImageGdt,0,0,400,400,ImageID(iImage))
DisableGadget(#ImageGdt,#True)
EndIf
ButtonGadget(#BtnExit,10,10,50,30,"Exit")
HideWindow(#Win,#False)
StickyWindow(#Win,#True)
iQuit.i = #False
iEventID.i = 0
Repeat
iEventID = WaitWindowEvent(1)
Select iEventID
Case #WM_LBUTTONDOWN
SendMessage_(WindowID(#Win), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
Case #WM_RBUTTONDOWN : iQuit = #True
Case #PB_Event_Gadget
If (EventGadget() = #BtnExit) : iQuit = #True : EndIf
EndSelect
Until iQuit = #True
EndIf
FreeImage(iImage)
End



