作者fumizuki (小獅)
看板Visual_Basic
標題Re: [請益] 請各位幫幫我.....(剛學VB6.0= =)
時間Wed May 18 10:32:45 2005
'專案需一個表單,一個Timer控制項,一個Command控制項,屬性不需設定。
Dim Light As Integer, Second As Integer
Private Sub Form_Load()
Timer1.Interval = 1000
'每一秒更新一次燈號
Set Picture = Image1(Light).Picture
'預設綠燈
End Sub
Private Sub Timer1_Timer()
Dim Flag As Integer
Second = Second + 1
If Light = 0 Then
If Second = 5 Then Light = 1: Flag = 1
'綠燈變黃燈
ElseIf Light = 1 Then
If Second = 2 Then Light = 2: Flag = 1
'黃燈變紅燈
Else
If Second = 7 Then Light = 0: Flag = 1
'紅燈變綠燈
End If
If Flag = 1 Then Set Picture = Image1(Light).Picture
End Sub
Private Sub Command1_Click()
'手動變換燈號
Light = Light + 1
If Light = 3 Then Light = 0
Set Picture = Image1(Light).Picture
End Sub
--
VB 程式設計 倉木麻衣 PTT 星爺板 行列輸入法
======================================================
Visual_Basic MaiKuraki Stephen Array
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.222.155.162
1F:→ fumizuki:沒測試過,希望沒有筆誤 61.222.155.162 05/18