1.使用系统内自带的声音
System.Media.SystemSounds.Beep.Play();
System.Media.SystemSounds.Asterisk.Play();
System.Media.SystemSounds.Exclamation.Play();
System.Media.SystemSounds.Hand.Play();
System.Media.SystemSounds.Question.Play();
2.使用自定义的声音(非循环播放=== 播放一次;相对路径)
//增加声音提示 System.Media.SoundPlayer player = new SoundPlayer(); player.SoundLocation = Server.MapPath("~/Admin/voice/system.wav"); player.LoadAsync(); player.Play();
3.使用自定义声音(循环播放;绝对路径)
//增加声音提示
System.Media.SoundPlayer player = new SoundPlayer();
player.SoundLocation = @"C:\Program Files\Tencent\QQ\Plugin\com.tencent.paipai\Misc\Sound\PaiPaiMsg.wav";
player.LoadAsync();
player.PlayLooping();
Thread.Sleep(530);
player.Stop();
原文:http://www.cnblogs.com/buzi521/p/3794508.html