Dibawah ini terdapat bentuk dan kode program, buatlah bentuk program pada form seperti gambar dibawah ini, dengan menggunakan tool yaitu Shape dan Timer. Untuk merubah Shape kedalam bentuk kotak atau bundar anda bisa merubahnya melalui tabel Properties pada bagian Shape. Untuk Timer sendiri berfungsi menentukan interval waktu lampu akan berganti dalam satuan milisecond terdapat pada tabel Properties, dan kode program pun diletakkan di Timer.
Download Program VB Lampu Lalu Lintas
| Kode
Program : Private Sub Timer1_Timer() If Shape2.Visible Then Shape3.Visible = False Shape2.Visible = False Shape4.Visible = True ElseIf Shape4.Visible Then Shape4.Visible = False Shape3.Visible = True Shape2.Visible = False Else Shape2.Visible = True Shape3.Visible = False Shape4.Visible = False End If End Sub |

Tidak ada komentar:
Posting Komentar