Code : Tout sélectionner
#include <GUIConstants.au3>
; 8--8 888-8-888-88-88 8--8
;88-8-88-888-888-8888-888-888888888888--8888888
; 8
; -
; ZooMa-ZooMa-ZooMa-ZooMa-ZooMa-ZooMa-ZooMa 8
; 8
; Script to zoom on images -
; by Clearguy 8
; V. -
; 8
;88888-88-888-88-88-88-8888-888888-8-8-88-8888
; 8-8- 8-88-8-888-8-88-8 88--
#include
$hGUI = GUICreate("Zoomah", 500, 500)
GUISetState()
Global $CoordGUI2[2]
$CoordGUI2[0] = 40
$CoordGUI2[1] = 60
Global $Center[2]
$Center[0] = 200
$Center[1] = 200
$h_cGUI = GUICreate("Child GUI", 400, 400, 40, 60, $WS_CHILD + $WS_HSCROLL + $WS_VSCROLL, $WS_EX_CLIENTEDGE, $hGUI)
$n = GUICtrlCreatePic(@WorkingDir & 'terre.jpg', 0, 0, 2048, 2048)
GUICtrlSetPos($n, 0, 0, 400, 400)
GUISetState()
GUISwitch($hGUI)
HotKeySet("z", "zoom")
HotKeySet("s", "unzoom")
HotKeySet("{DOWN}", "down")
HotKeySet("{UP}", "up")
HotKeySet("{LEFT}", "left")
HotKeySet("{RIGHT}", "right")
Global $Size = 400, $rl = 0, $top = 0, $ZoomPercent = 1.1
Global $x, $x, $y, $y, $DeltaX, $DeltaY, $Abscisse = 0, $Ordonnee = 0
While 1
$GUIMsg = GUIGetMsg()
Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
Func unzoom()
$Cursor = GUIGetCursorInfo()
$x = $Cursor[0]
$y = $Cursor[1]
$x = $x - $CoordGUI2[0]
$y = $y - $CoordGUI2[1]
$x = $ZoomPercent * $x
$z = $ZoomPercent * $y
$DeltaX = $Center[0] - $x
$DeltaY = $Center[1] - $y
$Size = ($ZoomPercent - (2 * ($ZoomPercent - 1))) * $Size
$Abscisse = $Abscisse + $DeltaX
$Ordonnee = $Ordonnee + $DeltaY
GUICtrlSetPos($n, $Abscisse, $Ordonnee, $Size, $Size)
EndFunc ;==>unzoom
Func zoom()
$Cursor = GUIGetCursorInfo()
$x = $Cursor[0]
$y = $Cursor[1]
$x = $x - $CoordGUI2[0]
$y = $y - $CoordGUI2[1]
$x = $ZoomPercent * $x
$z = $ZoomPercent * $y
$DeltaX = $Center[0] - $x
$DeltaY = $Center[1] - $y
$Size = $ZoomPercent * $Size
$Abscisse = $Abscisse + $DeltaX
$Ordonnee = $Ordonnee + $DeltaY
GUICtrlSetPos($n, $Abscisse, $Ordonnee, $Size, $Size)
EndFunc ;==>zoom
Func down()
$top = $top - 10
GUICtrlSetPos($n, $rl, $top, $Size, $Size)
EndFunc ;==>down
Func up()
$top = $top + 10
GUICtrlSetPos($n, $rl, $top, $Size, $Size)
EndFunc ;==>up
Func left()
$rl = $rl + 10
GUICtrlSetPos($n, $rl, $top, $Size, $Size)
EndFunc ;==>left
Func right()
$rl = $rl - 10
GUICtrlSetPos($n, $rl, $top, $Size, $Size)
EndFunc ;==>right