On Windows 10 I can get the PanelGadget background color with
Code: Select all
GetSysColor_(#COLOR_WINDOW)
If I do the same on Windows 11, the TextGadget background stay grey. GetSysColor_(#COLOR_WINDOW) doesn't get the right color.
I achieved what I want with this trick (get pixel color from Panel background) but its pretty ugly...
Code: Select all
firstpass = #True
If OpenWindow(0, 200, 200, 200, 200, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
PanelGadget(1, 0, 0, 200, 200)
AddGadgetItem(1, -1, "Panel 1")
TextGadget(2, 50, 50, 100, 100, "", #PB_Text_Border)
CloseGadgetList()
BackGroundPanelColor = GetSysColor_(#COLOR_WINDOW)
SetGadgetColor(2, #PB_Gadget_BackColor, BackGroundPanelColor)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_CloseWindow
Quit = 1
EndIf
If firstpass And OSVersion() >= #PB_OS_Windows_11 And IsWindowVisible_(GetWindow_(WindowID(0), #GW_HWNDPREV))
firstpass = #False
StartDrawing(WindowOutput(0))
BackGroundPanelColor = Point(GadgetX(1, #PB_Gadget_WindowCoordinate) + 20, GadgetY(1, #PB_Gadget_WindowCoordinate) + 20)
; Circle(GadgetX(1, #PB_Gadget_WindowCoordinate) + 20, GadgetY(1, #PB_Gadget_WindowCoordinate) + 20, 3, #Red)
StopDrawing()
SetGadgetColor(2, #PB_Gadget_BackColor, BackGroundPanelColor)
EndIf
Until Quit = 1
EndIf
End
Thanks for your time.