Re: How to Window and Gadget BackColor & FrontColor use RGBA
Posted: Sun Feb 12, 2017 10:36 pm
most correctly WinTransparentColor() and Example,this:
and please think behaviour of BackColor
and please think behaviour of BackColor
Code: Select all
Procedure WinTransparentColor(Win,TransparentColor=#Green,WindowBgTransparent=1);user may change Default Color
If WindowBgTransparent=1:SetWindowColor(Win,TransparentColor):EndIf
SetWindowLongPtr_(WindowID(Win), #GWL_EXSTYLE,$00080000)
SetLayeredWindowAttributes_(WindowID(Win),TransparentColor, 0, #LWA_COLORKEY);#LWA_COLORKEY=1
EndProcedure
;Transparent For Window And Gadget,If them use TransparentColor
If OpenWindow(0,0,0,800,500,"TransparentColor,please think behaviour of BackColor",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
LoadFont(0,"Arial Black", 24, #PB_Font_Bold):SetGadgetFont(#PB_Default, FontID(0))
WinTransparentColor(0,#Green,0)
SetWindowColor(0,#Red)
TextGadget(7,0,120,500,200," "):SetGadgetColor(7,#PB_Gadget_BackColor,$eeeeee)
ButtonGadget(0, 0, 0,200, 60, "Button 0")
StringGadget(1, 0, 60,200, 60, "String 1")
StringGadget(2, 0, 120,200, 60, "String 2")
ContainerGadget(6, 158, 30, 306, 333, #PB_Container_Raised)
;ButtonGadget(5, 0, 0,200, 60, "Button 5")
StringGadget(3, 0, 100,200, 60, "String 3")
StringGadget(4, 0, 180,200, 60, "String 4")
SetGadgetColor(6,#PB_Gadget_BackColor,$f0f088)
For a=1 To 4
SetGadgetColor(a,#PB_Gadget_BackColor,#Green)
Next
Repeat:Select WaitWindowEvent(5000)
Case #PB_Event_CloseWindow:Quit = 1
EndSelect:Until Quit = 1
EndIf:End