Program of working of Traffic light using VB6.0
Shape |
Timer |
1) Draw three shapes and Timer controller
2)Properties window (F4) or View--- Properties window
a) Select each shape and set:-
shape1---back style :Opaque
shape1---back color : red
shape1---shape---Circle
shape2---back style :Opaque
shape2---back color :green
shape2---shape---Circle
shape3---back style :Opaque
shape3---back color :yellow
shape3---shape---Circle
b) Select Timer controller
interval :1000
Source code
Dim f as integer
Private sub form1-load()
shape1.visible=true
shape2.visible=false
shape3.visible=false
f=1
end sub
Private sub Timer1-timer()
select case f
case 1
shape1.visible=false
shape2.visible=true
shape3.visible=false
f=2
case2
shape1.visible=false
shape2.visible=false
shape3.visible=true
f=3;
case 3
shape1.visible=true
shape2.visible=false
shape3.visible=false
f=1
end select
end sub
No comments:
Post a Comment