Timer vbnet

  • Creatore Discussione Creatore Discussione ajcardo
  • Data di inizio Data di inizio

ajcardo

Nuovo Utente
24 Set 2010
1
0
0
Ciao a tutti sono nuovo del forum.
Non ho molta esperienza nel vb.net ma sto creando un programma che fa degli screen e che li salva in una cartella specifica.

ecco il codice di quello che ho fatto fino ad ora:


HTML:
[COLOR="navy"]Public Class Form1
    Dim j As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Button1.Text = "Start" Then
            Button1.Text = "Stop"
            System.Threading.Thread.Sleep(35000)
            Dim bmp As Bitmap = New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
            Dim g As Graphics = Graphics.FromImage(bmp)
            g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, _
                             Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy)
            g.Dispose()
            Dim gino As Double
            gino = Int((99999999999999999 - 1 + 1) * Rnd()) + 1
            bmp.Save("C:\\" & gino & ".jpg")
            Me.Show()
        Else
            If Button1.Text = "Stop" Then
                Button1.Text = "Sto uppando il file..."
                System.Threading.Thread.Sleep(300)
                Me.Close()
            End If
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    End Sub
End Class[/COLOR]

ora vorrei inserire un timer in modo che faccia da solo uno screen ogni 3 minuiti e che alla seconda pressione del tasto start (che dopo essere stato cliccato diventa stop) il programma si chiudesse.

Mi potete dare una mano?? non ho un idea di come si usi il timer e su google ci sono spiegazioni varie ma che nn fanno molto al mio caso..

grazie XD :p
 

Discussioni simili