System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:\mywavfile.wav"); < change this part to whatever sound we want
player.Play();
player.Play();
private void Button_Click(object sender, EventArgs e)
{
using (var soundPlayer = new SoundPlayer(@"c:\Windows\Media\chimes.wav")) {
soundPlayer.Play(); // can also use soundPlayer.PlaySync()
}
}
{
using (var soundPlayer = new SoundPlayer(@"c:\Windows\Media\chimes.wav")) {
soundPlayer.Play(); // can also use soundPlayer.PlaySync()
}
}
No comments:
Post a Comment