You could easily find yourself in the murky waters of ownerdraw here, but if you're sneaky you can play a trick to approximate it. It isn't perfect but it's close. Important: Only works with XP skins enabled. Your pic shows the button with skins enabled so this shouldn't limit you:
Code: Select all
#BCN_FIRST = -1250
#BCN_HOTITEMCHANGE = #BCN_FIRST+1
#HICF_ENTERING = 17
#HICF_LEAVING = 33
Structure NMBCHOTITEM
hdr.NMHDR
flags.l
EndStructure
Procedure WinProc(hwnd, msg, wparam, lparam)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_NOTIFY
*nmh.NMBCHOTITEM = lparam
If *nmh\hdr\hwndFrom = GadgetID(2) And *nmh\hdr\code = #BCN_HOTITEMCHANGE
Select *nmh\flags
Case #HICF_ENTERING
SetGadgetColor(0,#PB_Gadget_BackColor, #Red)
Case #HICF_LEAVING
SetGadgetColor(0,#PB_Gadget_BackColor, GetSysColor_(#COLOR_3DFACE))
EndSelect
EndIf
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0, 0, 0, 150, 100,"", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetWindowCallback(@WinProc())
ContainerGadget(0,50,35,50,30)
ContainerGadget(1,1,1,48,28)
ButtonGadget(2, -1,-1, 50, 30, "")
CloseGadgetList() : CloseGadgetList()
Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow