不建议选20个PICTUREBOX 来显示.你可以用 FORM 动态加载背景来显示你的20个警报,个人意见仅供参考.
用APIBEEP效果还可以,可以试试:Private Declare Function APIBeep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long Dim n As LongPrivate Sub Form_Load() For i = 0 To 19 Picture1(i).Visible = False Next End SubPrivate Sub Timer1_Timer() Dim temp As Integer temp = Int(20 * Rnd) n = n + 1 If n = 4 Then Picture1(temp).Visible = True APIBeep 2000 * Rnd, 1000 * Rnd '不同的声音效果 n = 0 End If Picture1(temp).Visible = False End Sub
'播放警报声音 Private Sub Timer2_Timer() Dim temp As Integer If PicDVR1(temp).Visible = True Then APIBeep 2000 * Rnd, 1000 * Rnd '不同的声音效果 End If End Sub 子程序或函数未定义.怎么办?
--------------用TIMER 来控制PICTURE1(I) 的显示
发音可以用播放WAV文件来实现.如果不要求很悦耳,可以用VB自带的BEEP
Dim n As LongPrivate Sub Form_Load()
For i = 0 To 19
Picture1(i).Visible = False
Next
End SubPrivate Sub Timer1_Timer()
Dim temp As Integer
temp = Int(20 * Rnd)
n = n + 1
If n = 4 Then
Picture1(temp).Visible = True
APIBeep 2000 * Rnd, 1000 * Rnd '不同的声音效果
n = 0
End If
Picture1(temp).Visible = False
End Sub
Private Sub Timer2_Timer()
Dim temp As Integer
If PicDVR1(temp).Visible = True Then
APIBeep 2000 * Rnd, 1000 * Rnd '不同的声音效果
End If
End Sub
子程序或函数未定义.怎么办?