Code: Alles auswählen
#window=0
#image1=1
#image2=2
#normal1=1
#over1=2
#normal2=3
#over2=4
Procedure MakePlate(id.l,x.l,y.l,t$,fg.l,bg.l)
CreateImage(id,x,y)
StartDrawing(ImageOutput())
Box(0, 0,x,y,bg)
DrawingMode(1)
FrontColor(Red(fg),Green(fg), Blue(fg))
w.l=TextLength(t$)
h.l=TextLength("Mi")
Locate(x/2-w/2,y/2-h/2)
DrawText(t$)
StopDrawing()
EndProcedure
Procedure myMouseOver(hWnd)
GetCursorPos_(cursor.POINT)
MapWindowPoints_(0,hWnd,cursor,1)
ProcedureReturn ChildWindowFromPoint_(hWnd,cursor\x,cursor\y)
EndProcedure
MakePlate(#normal1,150,300,"Bild1a",$ffffff,$11ff11)
MakePlate(#over1,150,300,"Bild1b",$ffffff,$1111ff)
MakePlate(#normal2,200,200,"Bild2a",$ffffff,$ff1111)
MakePlate(#over2,200,200,"Bild2b",$ffffff,$11ffff)
OpenWindow(#window,600,400,600,400, #PB_Window_ScreenCentered | #PB_Window_SystemMenu, "mouseover")
CreateGadgetList(WindowID())
ImageGadget(#image1,10,10,150,300,UseImage(#normal1))
ImageGadget(#image2,300,100,200,200,UseImage(#normal2),#PB_Image_Border )
Repeat
EventID = WaitWindowEvent()
MouseOverID=myMouseOver(WindowID())
Select MouseOverID
Case GadgetID(#image1)
SetGadgetState(#image1,UseImage(#over1))
Case GadgetID(#image2)
SetGadgetState(#image2,UseImage(#over2))
Default
SetGadgetState(#image1,UseImage(#normal1))
SetGadgetState(#image2,UseImage(#normal2))
EndSelect
Until EventID=#PB_EventCloseWindow