cosi funziona meglio
codice:
Public Class Form1
Dim c As String
Dim start As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "start"
start = False
Timer1.Stop()
' ogni minuto fa lo screenshoot
Timer1.Interval = 10000
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim bounds As Rectangle
Dim Screenshot As System.Drawing.Bitmap
Dim graph As Graphics
Dim percorso As String
Static b As Integer
bounds = Screen.PrimaryScreen.Bounds
Screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(Screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
b = b + 1
percorso = Application.StartupPath & "\" & b & ".jpg"
Screenshot.Save(percorso, System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If start = False Then
Button1.Text = "stop"
Timer1.Start()
start = True
Else
Button1.Text = "start"
Timer1.Stop()
start = False
End If
End Sub
End Class