我现在有一大堆的picture1(20个)(用来控制20个警报器),当load的时候全部不可见.然后当显示picture1的时候(picture1(i).visible=true)发出声音就行.怎么办?高手帮忙!

解决方案 »

  1.   

    然后当显示picture1的时候(picture1(i).visible=true)发出声音就行.怎么办?高手帮忙!
    --------------用TIMER 来控制PICTURE1(I) 的显示
    发音可以用播放WAV文件来实现.如果不要求很悦耳,可以用VB自带的BEEP
      

  2.   

    不建议选20个PICTUREBOX 来显示.你可以用 FORM 动态加载背景来显示你的20个警报,个人意见仅供参考.
      

  3.   

    用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
      

  4.   

    '播放警报声音
    Private Sub Timer2_Timer()
        Dim temp As Integer
        If PicDVR1(temp).Visible = True Then
            APIBeep 2000 * Rnd, 1000 * Rnd '不同的声音效果
        End If
    End Sub
    子程序或函数未定义.怎么办?