Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
PictureBox1.Left = 0
PictureBox2.Left = 0
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim a, b As Integer
Randomize()
a = Rnd() * 30
b = Rnd() * 30
PictureBox1.Left += a
PictureBox2.Left += b
If PictureBox1.Left > 800 Or PictureBox2.Left > 800 Then
Timer1.Stop()
If Timer1.Enabled = False Then
If PictureBox1.Left > PictureBox2.Left Then
Label1.Text += "Kazanan A Arabası"
Else
Label1.Text += "Kazanan B Arabası"
End If
Else
Button2.Enabled = False
End If
End If
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
Timer1.Interval = HScrollBar1.Value + 1
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.Close()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub