作者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