Public Class Form1
Dim board(9, 9) As Boolean
Dim drawnBoard(9, 9) As PictureBox
Dim sq As Square
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pb As PictureBox
For I = 0 To 9
For J = 0 To 9
pb = New PictureBox
pb.ImageLocation = "C:\Users\joshwaxman.CSDEPT.000\Pictures\box.png"
pb.Location = New Point(J * 16, I * 16)
pb.Size = New Point(16, 16)
pb.SizeMode = PictureBoxSizeMode.StretchImage
pb.Visible = False
Controls.Add(pb)
drawnBoard(I, J) = pb
Next J
Next I
sq = New Square()
sq.Construct()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' draw the piece
For I = 0 To sq.data.GetUpperBound(0)
For J = 0 To sq.data.GetUpperBound(1)
If sq.data(I, J) = True Then
drawnBoard(sq.Y + I, sq.X + J).Visible = True
Else
drawnBoard(sq.Y + I, sq.X + J).Visible = False
End If
Next
Next
End Sub
End Class
Public Class Square
Public data(1, 1) As Boolean
Public X As Integer
Public Y As Integer
Public Sub Construct()
data(0, 0) = True
data(0, 1) = True
data(1, 0) = True
data(1, 1) = True
End Sub
End Class
Monday, August 2, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment