Public Class Form1
Dim txtboxes(9) As TextBox
Dim apple As PictureBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dim txt As TextBox
'For i = 0 To 9
' txt = New TextBox
' txt.BackColor = Color.AliceBlue
' txt.Location = New Point(100, i * 50)
' Me.Controls.Add(txt)
' txtboxes(i) = txt
'Next
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' animate!
If apple IsNot Nothing Then
apple.Location = New Point(apple.Location.X, apple.Location.Y + 4)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
addAnApple()
Timer1.Enabled = True
End Sub
Private Sub apple_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Controls.Remove(apple)
apple = Nothing
Label1.Text = Label1.Text + 100
addAnApple()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
addAnApple()
End Sub
Sub addAnApple()
Dim r As New Random
apple = New PictureBox
' Me.Width(-90)
apple.Location = New Point(r.Next(0, Me.Width - 90), 12)
apple.ImageLocation = "C:\Users\joshwaxman.CSDEPT.000\Pictures\APPLE.jpg"
apple.SizeMode = PictureBoxSizeMode.StretchImage
apple.Size = New Point(90, 90)
AddHandler apple.Click, AddressOf apple_Click
Me.Controls.Add(apple)
End Sub
End Class
Wednesday, July 28, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment