藉助media類:
首先引用類庫:
using System.Media;
然後:
1:建立對象:
SoundPlayer soundPlayer = new SoundPlayer();
2:選擇文件路徑
soundPlayer.SoundLocation = Application.StartupPath + "//" +"Sound"+"//"+"xinxi.wav"; //聲音的地址一般放在bin/debug中
3:裝載
soundPlayer.Load();
4:播放
soundPlayer.Play();