I found many examples which change the color of the panelgadget, but xp-style theme has to be disabled for that. Is there any solution to change colors without disabling it?
I would like to use PureColor, but i don't know if it works together with the new version of purebasic.
Gadget Colors
Re: Gadget Colors
Could you use cross-platform TabBarGadget()?
Re: Gadget Colors
Sometimes it would be fine to change the background around a PanelGadget, here's a modified code I've found (somewhere/-when) in the forum - there's still an issue, because I could not find out the best value for the left position of the text gadget.
Code: Select all
#DisableTheme=0
Global GadgetBackgroundColor=CreateSolidBrush_(#Yellow)
Global WindowBackgroundColor=#Green
Global Font=LoadFont(0,"Calibri",Random(2)<<2+8)
Global PanelLeft=10
Global PanelTop=10
Global PanelWidth=380
Global PanelHeight=280
OpenWindow(0,0,0,400,300,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SetWindowColor(0,WindowBackgroundColor)
PanelGadget(1,PanelLeft,PanelTop,PanelWidth,PanelHeight)
SetGadgetFont(1,Font)
AddGadgetItem(1,0,"One")
AddGadgetItem(1,1,"Two")
AddGadgetItem(1,2,"Three")
CloseGadgetList()
If #DisableTheme And OSVersion()>=#PB_OS_Windows_XP And OpenLibrary(0,"uxtheme.dll")
Nil.w
CallFunction(0,"SetWindowTheme",GadgetID(1),@Nil,@Nil)
CloseLibrary(0)
SetClassLong_(GadgetID(1), #GCL_HBRBACKGROUND,GadgetBackgroundColor)
InvalidateRect_(GadgetID(1),0,1)
Else
SetGadgetColor(1,#PB_Gadget_BackColor,GadgetBackgroundColor)
EndIf
RectA.Rect
RectB.Rect
A=GadgetID(1)
B=GetWindow_(GadgetID(1),#GW_CHILD)
GetWindowRect_(A,@RectA)
GetWindowRect_(B,@RectB)
Height=RectB\top-RectA\top-GetSystemMetrics_(#SM_CYEDGE)
TextGadget(2,148,PanelTop,244,Height,"")
SetGadgetColor(2,#PB_Gadget_BackColor,WindowBackgroundColor)
BringWindowToTop_(GadgetID(2))
Repeat
Select WaitWindowEvent()
Case #WM_CHAR
; GiveMeThree(A)
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1