Code : Tout sélectionner
fenetre_principale = OpenWindow(#PB_Any,100,100,500,500,"Fenetre principale")
CreateGadgetList(WindowID(fenetre_principale))
texte_souris_x = TextGadget(#PB_Any, 10, 10, 200, 20, "")
texte_souris_y = TextGadget(#PB_Any, 10, 30, 200, 20, "")
StartDrawing(WindowOutput(fenetre_principale))
Repeat
evenement = WaitWindowEvent()
If evenement = #PB_Event_CloseWindow
End
EndIf
old_souris_x = souris_x
old_souris_y = souris_y
souris_x = WindowMouseX(fenetre_principale)
souris_y = WindowMouseY(fenetre_principale)
SetGadgetText(texte_souris_x, "Position en X : " + Str(souris_x))
SetGadgetText(texte_souris_y, "Position en Y : " + Str(souris_y))
If evenement = #WM_LBUTTONDOWN
tracer = 1
ElseIf evenement = #WM_LBUTTONUP
tracer = 0
EndIf
If tracer = 1
LineXY(old_souris_x,old_souris_y,souris_x,souris_y,$ff0000)
EndIf
ForEver
StopDrawing()

Merci d'avance!