现在的位置: 首页 > 综合 > 正文

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

2014年02月20日 ⁄ 综合 ⁄ 共 428字 ⁄ 字号 评论关闭

 同步播放:

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();

抱歉!评论已关闭.