Code : Tout sélectionner
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Image_0
#Image_1
#Image_2
EndEnumeration
;- Image Plugins
;- Image Globals
Global Image0
Global Image1
;- Catch Images
Image0 = CatchImage(0, ?Image0)
Image1 = CatchImage(1, ?Image1)
;- Images
DataSection
Image0:
IncludeBinary "D:\Dev\1.ico" ; icone 1
Image1:
IncludeBinary "D:\Dev\2.ico" ; icone 2
EndDataSection
Procedure Open_Window_0()
If OpenWindow(#Window_0, 338, 228, 299, 260, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "")
If CreateGadgetList(WindowID())
ImageGadget(#Image_0, 5, 0, 48, 48, Image0)
ImageGadget(#Image_1, 65, 0, 48, 48, Image1)
ImageGadget(#Image_2, 60, 110, 75, 50, Image2)
EndIf
EndIf
EndProcedure
Procedure changeimage()
Repeat
SetGadgetState(#Image_2,Image0)
Delay(1000)
SetGadgetState(#Image_2,Image1)
Delay(1000)
ForEver
EndProcedure
Open_Window_0()
CreateThread(@changeimage(),0)
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindowID() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadgetID() ; Is it a gadget event?
EventType = EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_EventGadget
If GadgetID = #Image_0
ElseIf GadgetID = #Image_1
ElseIf GadgetID = #Image_2
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
;