Advertisement
jsbsan

LupitaMain

May 29th, 2014
2,913
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 1.51 KB | None | 0 0
  1. ' Gambas class file
  2.  
  3. Public zoom As Integer = -5
  4.  
  5. Public Sub _new()
  6.  
  7. End
  8.  
  9. Public Sub Form_Open()
  10.  
  11.   settings.Read(Me)
  12.   Me.Title = "Lupita Zoom " & Str$(zoom + 5)
  13.   Timer1.Start()
  14.  
  15. End
  16.  
  17. Public Sub Timer1_Timer()
  18.  
  19.   Dim coordenadas As String
  20.   Dim mousex As Integer
  21.   Dim mousey As Integer
  22.  
  23.   'leo posicion del raton
  24.   'leer posicion del raton
  25.   coordenadas = funciones.ejecutar_comando("xdotool getmouselocation")
  26.  
  27.   'posicion:
  28.   Try mousex = Val(funciones.xmouse(coordenadas))
  29.   Try mousey = Val(funciones.ymouse(coordenadas))
  30.  
  31.   If Error Then Return
  32.  
  33.   If (mousex - Me.w / (10 + zoom)) < 0 Then
  34.     mousex = Me.w / (10 + zoom)
  35.   Endif
  36.  
  37.   If (mousey - Me.h / (10 + zoom)) < 0 Then
  38.     mousey = Me.h / (10 + zoom)
  39.   Endif
  40.  
  41.   If (mousex + (Me.w / (10 + zoom) * 2) / 2) > Screen.W Then
  42.     mousex = Screen.w - (Me.w / (10 + zoom) * 2) / 2
  43.   Endif
  44.  
  45.   If (mousey + (Me.h / (10 + zoom) * 2) / 2) > Screen.h Then
  46.     mousey = Screen.h - (Me.h / (10 + zoom) * 2) / 2
  47.    
  48.   Endif
  49.  
  50.   PictureBoxLupa.Picture = Desktop.Screenshot(mousex - Me.w / (10 + zoom), mousey - Me.h / (10 + zoom), Me.w / (10 + zoom) * 2, Me.h / (10 + zoom) * 2)
  51.  
  52. End
  53.  
  54. Public Sub Form_Resize()
  55.  
  56.   PictureBoxLupa.w = Me.W
  57.   PictureBoxLupa.h = Me.h
  58.  
  59. End
  60.  
  61. Public Sub PictureBoxLupa_MouseWheel()
  62.  
  63.   Debug Mouse.Delta
  64.   zoom += Mouse.Delta
  65.   If zoom <= -5 Then zoom = -5
  66.   Me.Title = "Lupita Zoom " & Str$(zoom + 5)
  67.  
  68. End
  69.  
  70. Public Sub Form_Close()
  71.  
  72.   settings.write(Me)
  73.  
  74. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement