Option Explicit
Private Sub chkStop_Click()
tmrPrelievo.Enabled = Not CBool(chkStop.Value)
End Sub
Private Sub Form_Load()
DC = GetDC(0)
frmZoomScreen.Height = picScreen.Height + pic3.Height + stbDettagli.Height + 120
frmZoomScreen.Width = picScreen.Width + pic1.Width + 120 * 3
End Sub
Private Sub Form_Resize()
picScreen.Height = frmZoomScreen.Height - pic3.Height * 2 - 120
pic3.Top = picScreen.Height + 120
pic2.Top = pic3.Top
picScreen.Width = frmZoomScreen.Width - pic1.Width - 120 * 4
pic3.Width = picScreen.Width
sldZoom.Width = pic3.Width
sldInterval.Width = pic3.Width
pic2.Left = pic3.Width + 120
pic1.Left = picScreen.Width + 120
End Sub
Private Sub Form_Unload(Cancel As Integer)
ReleaseDC 0, DC
End Sub
Private Sub cmdSalva_Click()
picScreen.AutoRedraw = True
tmrPrelievo.Enabled = False
Prelievo
CDialog.ShowSave
If CDialog.CancelError = False Then SavePicture picScreen.Image, CDialog.FileName
tmrPrelievo.Enabled = Not CBool(chkStop.Value)
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