C#、VB.NET 使用System.Media.SoundPlayer播放音乐

来源:互联网 发布:js随机函数 编辑:程序博客网 时间:2024/05/17 00:02


 同步播放:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();player.SoundLocation = @"d:/music/happy.wav";player.Load();player.Play();

 异步播放:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();player.SoundLocation = @"d:/music/happy.wav";player.LoadAsync();player.PlaySync();

 循环播放:

System.Media.SoundPlayer player = new System.Media.SoundPlayer();player.SoundLocation = @"d:/music/happy.wav";player.Load();player.PlayLooping();
0 0