I use following code to do a simple animation. But I want to use an button (when pressing it) to stop the animation when the pictureBox is still moving. So, how I can do it? Thanks.
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Dim t As Integer t = 0 For t = 1 To 80 Me.PictureBox1.Refresh() Me.PictureBox1.Top = Me.PictureBox1.Top - 1 System.Threading.Thread.Sleep(300) Next t Timer1.Enabled = False End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)