Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Timer Control for PictureBox created during runtime

LuvKnightLuvKnight Posts: 1Member
[code]Public Function NewApple()
Dim picNewApple As PictureBox = New PictureBox()
Dim AppleType As Integer = RandomNumber(100)
If AppleType >= 75 Then
picNewApple.Image = Image.FromFile(Application.StartupPath & "RedApple.gif")
ElseIf AppleType >= 50 Then
picNewApple.Image = Image.FromFile(Application.StartupPath & "GreenApple.gif")
ElseIf AppleType >= 25 Then
picNewApple.Image = Image.FromFile(Application.StartupPath & "GoldApple.gif")
ElseIf AppleType >= 0 Then
picNewApple.Image = Image.FromFile(Application.StartupPath & "WormApple.gif")
End If
picNewApple.Location = New System.Drawing.Point(RandomNumber(600), 5)
picNewApple.SizeMode = PictureBoxSizeMode.AutoSize
picNewApple.BackColor = Color.Transparent
Me.Controls.Add(picNewApple)
End Function
[/code]
I've this, is there anyway I could control the picturebox using a new event? This would be in a 1 second timer when a new apples comes out every second. Now I need to be able to control it location after it's added to the form by using the .Left

Hope someone understands me.

Sign In or Register to comment.