Solo agreguen un Timer al Form: Timer1
Y peguen este code.
Código
Option Explicit Dim X As Integer, s As Integer Dim max As Boolean Dim A As Integer Private Type Punto X As Single Y As Single IncX As Double IncY As Double End Type Private Matriz(1 To 2, 1 To 2) As Punto Private Declare Function SetWindowPos Lib "user32" ( _ ByVal hwnd As Long, _ ByVal hWndInsertAfter As Long, _ ByVal X As Long, _ ByVal Y As Long, _ ByVal cx As Long, _ ByVal cy As Long, _ ByVal wFlags As Long) As Long Private Const SW_SHOWNOACTIVATE = 4 Private Const SWP_SHOWWINDOW = &H40 Private Const SWP_NOACTIVATE = &H10 Private Sub DibujaPlanos() Dim auxX As Integer Dim auxY As Integer Dim auxI As Integer Dim auxJ As Integer Dim P1 As Punto Dim P2 As Punto Dim P3 As Punto Dim P4 As Punto For auxX = 1 To UBound(Matriz, 1) - 1 For auxY = 1 To UBound(Matriz, 2) - 1 P1 = Matriz(auxX, auxY) P2 = Matriz(auxX + 1, auxY) P3 = Matriz(auxX + 1, auxY + 1) P4 = Matriz(auxX, auxY + 1) Line (P1.X, P1.Y)-(P2.X, P2.Y), vbGreen Line (P2.X, P2.Y)-(P3.X, P3.Y), vbGreen Line (P3.X, P3.Y)-(P4.X, P4.Y), vbGreen Line (P4.X, P4.Y)-(P1.X, P1.Y), vbGreen auxJ = 10 For auxI = 1 To auxJ Line (P1.X + (P2.X - P1.X) * (auxI / auxJ), _ P1.Y + (P2.Y - P1.Y) * (auxI / auxJ))- _ (P4.X + (P3.X - P4.X) * (auxI / auxJ), _ P4.Y + (P3.Y - P4.Y) * (auxI / auxJ)), vbGreen Line (P2.X + (P3.X - P2.X) * (auxI / auxJ), _ P2.Y + (P3.Y - P2.Y) * (auxI / auxJ))- _ (P1.X + (P4.X - P1.X) * (auxI / auxJ), _ P1.Y + (P4.Y - P1.Y) * (auxI / auxJ)), vbGreen Next auxI Next auxY Next auxX End Sub Private Sub Form_Activate() Call Form_DblClick End Sub Private Sub Form_Click() End End Sub Private Sub Form_DblClick() Dim auxX As Integer Dim auxY As Integer 'Me.Cls For auxX = 1 To UBound(Matriz, 1) For auxY = 1 To UBound(Matriz, 2) Matriz(auxX, auxY).X = Int(Rnd * (Me.Width - 120)) Matriz(auxX, auxY).Y = Int(Rnd * (Me.Height - 405)) 'Matriz(auxX, auxY).X = ((Me.Width - 120) \ (UBound(Matriz, 1) - 1)) * (auxX - 1) 'Matriz(auxX, auxY).Y = ((Me.Height - 405) \ (UBound(Matriz, 2) - 1)) * (auxY - 1) Matriz(auxX, auxY).IncX = Int(Rnd * 6) * 15 * IIf(Int(Rnd * 2) = 1, 1, -1) Matriz(auxX, auxY).IncY = Int(Rnd * 6) * 15 * IIf(Int(Rnd * 2) = 1, 1, -1) Next auxY Next auxX Call DibujaPlanos End Sub Private Sub Form_KeyPress(KeyAscii As Integer) End End Sub Private Sub Form_Load() Me.BackColor = 0 Me.WindowState = 2 Timer1.Interval = 1 Randomize End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'End End Sub Private Sub Timer1_Timer() Dim auxX As Integer Dim auxY As Integer Dim auxI As Integer Dim auxJ As Integer Dim P1 As Punto Dim P2 As Punto Dim P3 As Punto Dim P4 As Punto ''' Me.Cls For auxX = 1 To UBound(Matriz, 1) - 1 For auxY = 1 To UBound(Matriz, 2) - 1 P1 = Matriz(auxX, auxY) P2 = Matriz(auxX + 1, auxY) P3 = Matriz(auxX + 1, auxY + 1) P4 = Matriz(auxX, auxY + 1) Line (P1.X, P1.Y)-(P2.X, P2.Y), Me.BackColor Line (P2.X, P2.Y)-(P3.X, P3.Y), Me.BackColor Line (P3.X, P3.Y)-(P4.X, P4.Y), Me.BackColor Line (P4.X, P4.Y)-(P1.X, P1.Y), Me.BackColor auxJ = 10 For auxI = 1 To auxJ Line (P1.X + (P2.X - P1.X) * (auxI / auxJ), _ P1.Y + (P2.Y - P1.Y) * (auxI / auxJ))- _ (P4.X + (P3.X - P4.X) * (auxI / auxJ), _ P4.Y + (P3.Y - P4.Y) * (auxI / auxJ)), Me.BackColor Line (P2.X + (P3.X - P2.X) * (auxI / auxJ), _ P2.Y + (P3.Y - P2.Y) * (auxI / auxJ))- _ (P1.X + (P4.X - P1.X) * (auxI / auxJ), _ P1.Y + (P4.Y - P1.Y) * (auxI / auxJ)), Me.BackColor Next auxI Next auxY Next auxX For auxX = 1 To UBound(Matriz, 1) For auxY = 1 To UBound(Matriz, 2) If (Matriz(auxX, auxY).X + Matriz(auxX, auxY).IncX) > Me.Width - 120 Then Matriz(auxX, auxY).IncX = Matriz(auxX, auxY).IncX * -1 ElseIf (Matriz(auxX, auxY).X + Matriz(auxX, auxY).IncX) < 0 Then Matriz(auxX, auxY).IncX = Matriz(auxX, auxY).IncX * -1 End If Matriz(auxX, auxY).X = Matriz(auxX, auxY).X + Matriz(auxX, auxY).IncX If (Matriz(auxX, auxY).Y + Matriz(auxX, auxY).IncY) > Me.Height - 405 Then Matriz(auxX, auxY).IncY = Matriz(auxX, auxY).IncY * -1 ElseIf (Matriz(auxX, auxY).Y + Matriz(auxX, auxY).IncY) < 0 Then Matriz(auxX, auxY).IncY = Matriz(auxX, auxY).IncY * -1 End If Matriz(auxX, auxY).Y = Matriz(auxX, auxY).Y + Matriz(auxX, auxY).IncY Next auxY Next auxX Call DibujaPlanos End Sub