Option Explicit
Private Sub Ridimensiona(Larghezza As Integer, Altezza As Integer)
Dim ProporzioneAL As Double
If laghezza < 6000 Or Altezza < 4650 Then
Larghezza = 6000
Altezza = 4650
End If
ProporzioneAL = Altezza / Larghezza
End Sub
Private Sub chkMouse_Click()
imgMouse.Visible = CBool(chkMouse.Value)
End Sub
Private Sub cmdPausaRiprendi_Click()
tmrPrelievo.Enabled = Not tmrPrelievo.Enabled
If tmrPrelievo.Enabled = False Then
cmdPausaRiprendi.Caption = "Riprendi"
picScreen.AutoRedraw = True
Else
cmdPausaRiprendi.Caption = "Pausa"
picScreen.AutoRedraw = False
End If
End Sub
Private Sub Form_Load()
DC = GetDC(0)
End Sub
Private Sub Form_Unload(Cancel As Integer)
ReleaseDC 0, DC
End Sub
Private Sub cmdSalva_Click()
picScreen.AutoRedraw = True
tmrPrelievo.Enabled = False
If cmdPausaRiprendi.Caption = "Riprendi" Then
CDialog.ShowSave
If CDialog.CancelError = False Then SavePicture picScreen.Image, CDialog.FileName
Exit Sub
End If
Prelievo
CDialog.ShowSave
If CDialog.CancelError = False Then SavePicture picScreen.Image, CDialog.FileName
tmrPrelievo.Enabled = True
picScreen.AutoRedraw = False
End Sub
Private Sub sldInterval_Scroll()
txtInterval = sldInterval.Value
End Sub
Private Sub sldZoom_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc("+") Then sldZoom.Value = sldZoom.Value + 1
If KeyAscii = Asc("-") Then sldZoom.Value = sldZoom.Value - 1
txtZoom.Text = sldZoom.Value
End Sub
Private Sub sldZoom_Scroll()
txtZoom = sldZoom.Value
End Sub
Private Sub Prelievo()
Dim Mouse As Pointapi
Dim Dimensione As Pointapi
GetCursorPos Mouse
Dimensione.x = picScreen.ScaleWidth / sldZoom.Value * 100
Dimensione.y = picScreen.ScaleHeight / sldZoom.Value * 100
If chkRefresh.Value = vbChecked Then picScreen.Refresh
If chkinvertito.Value = vbChecked Then
StretchBlt picScreen.hdc, 0, 0, picScreen.ScaleWidth, picScreen.ScaleHeight, DC, Mouse.x - Dimensione.x / 2, Mouse.y - Dimensione.y / 2, Dimensione.x, Dimensione.y, vbNotSrcCopy
Else
StretchBlt picScreen.hdc, 0, 0, picScreen.ScaleWidth, picScreen.ScaleHeight, DC, Mouse.x - Dimensione.x / 2, Mouse.y - Dimensione.y / 2, Dimensione.x, Dimensione.y, vbSrcCopy
End If
'If imgMouse.Visible = True Then picScreen.PaintPicture imgMouse.Picture, Dimensione.x / 2, Dimensione.y / 2
stbDettagli.Panels(1).Text = "Coordina X del mouse: " & Mouse.x
stbDettagli.Panels(2).Text = "Coordina Y del mouse: " & Mouse.y
End Sub
Private Sub tmrPrelievo_Timer()
Prelievo
End Sub
Private Sub txtInterval_Change()
txtInterval = Val(txtInterval)
sldInterval.Value = txtInterval
tmrPrelievo.Interval = txtInterval
End Sub
Private Sub txtInterval_GotFocus()
txtInterval.SelStart = 0
txtInterval.SelLength = Len(txtInterval)
End Sub
Private Sub txtZoom_Change()
sldZoom.Value = Val(txtZoom)
txtZoom = Val(txtZoom)
End Sub
Private Sub txtZoom_GotFocus()
txtZoom.SelStart = 0
txtZoom.SelLength = Len(txtZoom)
End Sub