在Click Event上播放声音

时间:2016-06-17 10:57:54

标签: vb.net audio click

每次点击某个地方,我都可以创建一个播放声音的程序吗?我真的需要这个。就像在某些操作系统中,每次点击窗口时它都会发出声音。




1 个答案:

答案 0 :(得分:0)

使用Button_Click Event显示示例。

Playing System Sounds

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click            
        My.Computer.Audio.PlaySystemSound( _
        System.Media.SystemSounds.Exclamation)
    End Sub

Playing Specified Sounds

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        My.Computer.Audio.Play("C:\Mysound.wav", _
        AudioPlayMode.BackgroundLoop)
    End Sub