Other things |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis ligula lorem, consequat eget, tristique nec, auctor quis, purus. Vivamus ut sem. Fusce aliquam nunc vitae purus. |
Other things |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis ligula lorem, consequat eget, tristique nec, auctor quis, purus. Vivamus ut sem. Fusce aliquam nunc vitae purus. |
Other things |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis ligula lorem, consequat eget, tristique nec, auctor quis, purus. Vivamus ut sem. Fusce aliquam nunc vitae purus. |
Other things |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis ligula lorem, consequat eget, tristique nec, auctor quis, purus. Vivamus ut sem. Fusce aliquam nunc vitae purus. |
Other things |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis ligula lorem, consequat eget, tristique nec, auctor quis, purus. Vivamus ut sem. Fusce aliquam nunc vitae purus. |
|
VB 7 |
Minggu, Mei 31, 2009 |
Nie script na!!!!!!!
the following constants are used to give the lights a certain color Const Off = &H8000000F Const Red = vbRed Const Green = vbGreen Const Orange = &H80C0FF
'a simple traffic junction of two perpendicular crossing streets 'consists of 4 traffic poles. Each traffic pole has a green, orange 'and red light. There is always just one light on per pole.
'The traffic lights control on one of those junctions has just 4 'statusses. The current status is stored in the variable "Status". Dim Status As Integer
'The time a status lasts, is derived from the following constants, which 'indicate the time in seconds. Const TimeForStatus1 = 5 Const TimeForStatus2 = 3 Const TimeForStatus3 = 5 Const TimeForStatus4 = 3
Private Sub SetStatus(ByVal intStatus As Integer) 'Set the status variable to the new status Status = intStatus
'Turn off all the lights shpLamp1Groen.FillColor = Off shpLamp1Oranje.FillColor = Off shpLamp1Rood.FillColor = Off shpLamp2Groen.FillColor = Off shpLamp2Oranje.FillColor = Off shpLamp2Rood.FillColor = Off shpLamp3Groen.FillColor = Off shpLamp3Oranje.FillColor = Off shpLamp3Rood.FillColor = Off shpLamp4Groen.FillColor = Off shpLamp4Oranje.FillColor = Off shpLamp4Rood.FillColor = Off 'Turn on the appropriate lights with the correct color, 'depending on the current status Select Case intStatus 'or "Select Case Status", won't make any difference Case 1 shpLamp1Rood.FillColor = Red shpLamp2Groen.FillColor = Green shpLamp3Rood.FillColor = Red shpLamp4Groen.FillColor = Green Timer1.Interval = TimeForStatus1 * 1000 Case 2 shpLamp1Rood.FillColor = Red shpLamp2Oranje.FillColor = Orange shpLamp3Rood.FillColor = Red shpLamp4Oranje.FillColor = Orange Timer1.Interval = TimeForStatus2 * 1000 Case 3 shpLamp1Groen.FillColor = Green shpLamp2Rood.FillColor = Red shpLamp3Groen.FillColor = Green shpLamp4Rood.FillColor = Red Timer1.Interval = TimeForStatus3 * 1000 Case 4 shpLamp1Oranje.FillColor = Orange shpLamp2Rood.FillColor = Red shpLamp3Oranje.FillColor = Orange shpLamp4Rood.FillColor = Red Timer1.Interval = TimeForStatus4 * 1000 End Select 'We need to call the following subroutine RefreshLights End Sub
Private Sub RefreshLights() 'This subroutine makes sure that de data on the screen is 'displayed correctly shpLamp1Groen.Refresh shpLamp1Oranje.Refresh shpLamp1Rood.Refresh shpLamp2Groen.Refresh shpLamp2Oranje.Refresh shpLamp2Rood.Refresh shpLamp3Groen.Refresh shpLamp3Oranje.Refresh shpLamp3Rood.Refresh shpLamp4Groen.Refresh shpLamp4Oranje.Refresh shpLamp4Rood.Refresh End Sub
Private Sub Form_Load() 'When the programs starts, it starts with status 1 SetStatus 1 'Initializing the timer will start the timer1_timer subroutine after the 'set interval has elapsed (in milliseconds) Timer1.Interval = TimeForStatus1 * 1000 End Sub Private Sub Timer1_Timer() 'Change to the next status Status = Status + 1 'If the next status is 5 then we need to change it back to one If Status = 5 Then Status = 1 SetStatus Status End Sub |
posted by Winn_Doeell @ 6:02:00 AM |
|
|
|
About Me |
Name: Winn_Doeell
Home: Malang, Jatim, Indonesia
About Me: Nama Q Windoel. hehehe Q pemlu tapi Q cew yang ceria. Q sebenarnya gk suka dapet masalah. Mbenceknoo.............. hahahahahah............... Q sayang ma orang2 di sekitar Q. Q kan membahagiakan ortu Q. hahahaha...........
See my complete profile
|
Previous Post |
|
Archives |
|
Links |
|
Powered by |
|
|
Posting Komentar