简单VB题 求大神解答
Dim blnalarm As Boolean
Dim strnow$
Private Sub Timer1_Timer()
Shape1.FillStyle = 0
End Sub
Private Sub Timer2_Timer()
Dim i%
If Shape1.FillStyle = 0 Then
Timer2.Enabled = True
For i = 1 To 3
Shape2.FillStyle = 0
Shape2.FillStyle = 1
Next i
Shape2.FillStyle = 0
End If
End Sub
比如 就是第一个红的先亮10秒 黄的再闪烁10秒 怎么搞代码?
Option Explicit
Dim yCount As Integer
Private Sub Form_Load()
Shape1.FillStyle = 0
Shape2.FillStyle = 1
Timer1.Enabled = True
Timer1.Interval = 10000
Timer2.Enabled = False
End Sub
Private Sub Timer1_Timer()
Shape1.FillStyle = 1
yCount = 20
Timer2.Interval = 500
Timer2.Enabled = True
Timer1.Enabled = False
End Sub
Private Sub Timer2_Timer()
If yCount > 0 Then
Shape2.FillStyle = yCount Mod 2
Else
Timer2.Enabled = False
End If
yCount = yCount - 1
End Sub
不用颤唯这么麻烦
你自己设计图片,一张黑的。先把红的写上,再定时10s,然茄耐培后黄黑交替0.5s。用FOR循环亩辩
Dim T As Integer
Private Sub Form_Load()
T = 0
End Sub
Private Sub Timer1_Timer()
T = T + 1
If T <= 10 Then
Shape1.FillStyle = 0
Else
Shape1.FillStyle = 1
Timer1.Enabled = False
Timer2.Enabled = True
T = 0
End If
End Sub
Private Sub Timer2_Timer()
T = T + 1
If (T Mod 2 = 0) And (T <= 10) Then
Shape2.FillStyle = 0
Else
Shape2.FillStyle = 1
End If
End Sub