如何在WinForms中播放声音?

如何用C#在WinForms中播放声音?

要简单地播放声音,没有交互,您可以使用System.Media.SoundPlayer:

System.Media.SoundPlayer player = new System.Media.SoundPlayer(); player.SoundLocation = "soundFile.wav"; player.Play(); 

NAudio是这类function的优秀图书馆。 你可以在这里找到它: http : //naudio.codeplex.com/

这里有一个介绍性的教程: http : //opensebj.blogspot.com/2009/02/introduction-to-using-naudio.html

干杯,塞巴斯蒂安