Loading

Jumat, 25 Maret 2011

Cara membuat traffic light dengan visual basic

Halo sobat blogger dan anak-anak RPLA kali ini saya akan memberikan tutorial cara membuat animasi trafffic light dengan visual basic

Pertama buatlah shape lalu kreasilah dengan gayamu sendiri lalu bentuklah seperti Traffic Light
Kedua buatlah label yang bertuliskan angka
Ketiga buatlah timer










Preview nya :







Berikut ini source codenya :



Private Sub Command1_Click()
Unload Me
End Sub


Private Sub Form_Load()
Label1.Caption = 1
End Sub


Private Sub Timer1_Timer() '
If Label1.Caption = 1 Then
Label1.Caption = 2
Shape1.FillColor = vbRed 'merah(1)
Shape2.FillColor = &H8080& 'kuning(1)
Shape3.FillColor = &H8000& 'hijau(1)
Shape4.FillColor = &H80&  'merah(2)
Shape5.FillColor = &H8080& 'kuning(2)
Shape6.FillColor = vbGreen 'hijau(2)
Else
If Label1.Caption = 2 Then
Label1.Caption = 3
Shape1.FillColor = vbRed
Shape2.FillColor = vbYellow
Shape3.FillColor = &H8000&
Shape4.FillColor = &H80&
Shape5.FillColor = vbYellow
Shape6.FillColor = &H8000&
Else
If Label1.Caption = 3 Then
Label1.Caption = 4
Shape1.FillColor = &H80&
Shape2.FillColor = &H8080&
Shape3.FillColor = vbGreen
 Shape4.FillColor = vbRed
Shape5.FillColor = &H8080&
Shape6.FillColor = &H8000&
Else
If Label1.Caption = 4 Then
Label1.Caption = 1
Shape1.FillColor = &H80&
Shape2.FillColor = vbYellow
Shape3.FillColor = &H8000&
Shape4.FillColor = vbRed
Shape5.FillColor = vbYellow
Shape6.FillColor = &H8000&
End If
End If
End If
End If
End Sub


Download projectnya



0 komentar:

Posting Komentar

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites