You are on page 1of 4

Coding lampu lalu lintas

Private Sub tunda()


a = Timer
Do While Timer < 1 + a
DoEvents
Loop
End Sub

Private Sub Command1_Click()


X = MsgBox("Ciyus Mau Mengakhiri ?", vbQuestion + vbOKCancel, "Perhatian")
If X = vbOK Then
End
End If
End Sub

Private Sub Command2_Click()


Timer1.Enabled = True
End Sub

Private Sub Form_Load()

Me.Width = 10
Me.Height = 10
End Sub

Private Sub Timer2_timer()


Me.Height = Me.Height + 100
Tengah
If Me.Height >= 20000 Then '3000 tergantung height form yg di inginkan
Timer2.Enabled = False
Tengah
End If

Me.Width = Me.Width + 100


Tengah
If Me.Width >= 20000 Then
Timer2.Enabled = False
Tengah
End If
End Sub
Public Sub Tengah()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Sub Timer1_Timer()
For i = 0 To 10
Label1.Caption = 11 - i
Label2.Caption = 21 - i
Label3.Caption = 31 - i
Label4.Caption = 41 - i
If i = 0 Then
Shape2.FillColor = &H8080&
Shape3.FillColor = &HFF00&
Shape10.FillColor = &H8080&
Shape1.FillColor = &H80&
Shape4.FillColor = vbRed
Shape7.FillColor = vbRed
Shape10.FillColor = vbRed
Shape11.FillColor = &H8080&
Else
Shape12.FillColor = &H8000&
Shape2.FillColor = &H8080&
Shape3.FillColor = vbGreen
Shape11.FillColor = &H8080&
End If
tunda
Next i
For i = 10 To 20
Label1.Caption = 51 - i
Label2.Caption = 21 - i
Label3.Caption = 31 - i
Label4.Caption = 41 - i
If i = 10 Then
Shape3.FillColor = &H8000&
Shape2.FillColor = vbYellow
Shape4.FillColor = vbRed
Else
Shape2.FillColor = &H8080&
Shape4.FillColor = &H80&
Shape1.FillColor = vbRed
Shape5.FillColor = &H8080&
Shape6.FillColor = vbGreen
End If
tunda
Next i
For i = 20 To 30
Label1.Caption = 51 - i
Label2.Caption = 61 - i
Label3.Caption = 31 - i
Label4.Caption = 41 - i
If i = 20 Then
Shape4.FillColor = &H80&
Shape6.FillColor = &H8000&
Shape5.FillColor = vbYellow
Shape7.FillColor = vbRed
Else
Shape4.FillColor = &HFF&
Shape7.FillColor = &H80&
Shape5.FillColor = &H8080&
Shape8.FillColor = &H8080&
Shape9.FillColor = vbGreen
End If
tunda
Next i
For i = 30 To 40
Label1.Caption = 51 - i
Label2.Caption = 61 - i
Label3.Caption = 71 - i
Label4.Caption = 41 - i
If i = 30 Then
Shape10.FillColor = &HC0&
Shape9.FillColor = &H8000&
Shape8.FillColor = &HFFFF&
Shape10.FillColor = vbRed
ElseIf i = 40 Then
Shape1.FillColor = vbRed
Shape7.FillColor = &HFF&
Shape12.FillColor = &H8000&
Shape1.FillColor = &HC0&
Shape11.FillColor = vbYellow
Else
Shape7.FillColor = &HFF&
Shape8.FillColor = &H8080&
Shape10.FillColor = &H80&
Shape11.FillColor = &H8080&
Shape12.FillColor = vbGreen
End If
tunda
Next i
End Sub

Private Sub Timer3_timer()


Judul.ForeColor = RGB(Rnd * 400, Rnd * 400, Rnd * 400)
If (Judul.Left + Judul.Width) <= 0 Then
Judul.Left = Me.Width
End If
Judul.Left = Judul.Left - 100
Label5.ForeColor = RGB(Rnd * 1000, Rnd * 1000, Rnd * 1000)
End Sub

You might also like