下面的例子画200个举行。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim RecCount As Integer = 200
Dim GridWidth, GridHeiht, StepWidth, StepHeight As Integer
Dim i, j As Integer
Dim g As Graphics = Me.CreateGraphics
Dim rndTest As New System.Random
For i = 0 To RecCount
For j = 0 To RecCount
g.DrawRectangle(New Pen(Color.FromArgb(rndTest.Next(0, 255), rndTest.Next(0, 255), rndTest.Next(0, 255))), New Rectangle(GridWidth * i + StepWidth * i, GridHeiht * j + StepHeight * j, GridWidth, GridHeiht))
Next
Next
g.Dispose()
End Sub
step1 动态生成1 picture ,生成object1,object2 in picture ,
step2 for i=0 to 800
step3 if select the object1 place1 drag to the place2 place1.object1.visible=false,place2.object1.visible=true,
step4 just visible