VB编程TIMER事件响应

来源:百度知道 编辑:UC知道 时间:2024/06/22 19:48:01
我用image控件组生成了9个控件,是数组,分别为image1(1),image1(2)等等,对每一个控件,我都添加了不同的图片。我想在每次单击不同的9个控件,会有不同的事件响应。分别是单机image1(1),该图片闪烁200毫秒,单机image1(2),该图片闪烁200毫秒……
我知道这个要用到TIMER控件,但不知道语句该怎么写,里面的“闪烁”语句怎么写,麻烦高手指点。
如:
Private Sub Image1_Click(Index As Integer)
Select case index
case 1'数组是1的image
操作
case 2
.....
end select
里面语句具体怎么写不清楚,请高手指点,谢谢

先将Time1的Interval的值设为200,即200毫秒触发一次;Enabled属性设为False,即开始的时候不闪烁。

Dim X As Integer
Private Sub Image1_Click(Index As Integer)
For i = 0 To 8'每次点击时,将所有图片可见
Image1(i).Visible = True
Next

X = Index'传递将要闪烁的图片序号
Timer1.Enabled = True'启动定时器

End Sub

Private Sub Timer1_Timer()
Image1(X).Visible = Not Image1(X).Visible'将点击的图片在可见与不可见之间切换,从而实现闪烁效果
End Sub

Private Sub Timer1_Timer()
b Image1
End Sub

Function b(s As Image)
If a = True Then
s.Visible = True
a = False
Exit Function
End If
If a = False Then
s.Visible = False
a = True
End If
End Function

通过显示和不显示image1来达到闪烁的目的了
剩下的代码自己写了