求c# winform设置每隔一分钟,循环播放音乐

LX1026465094 2015-07-28 04:05:11
把一首歌分为10段,设置每隔一分钟播一段,播完整首,再次循环播放
...全文
393 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
心灵彩虹 2015-07-28
  • 打赏
  • 举报
回复
获取到长度以后,定时播放暂停就可以了,这是思路。
心灵彩虹 2015-07-28
  • 打赏
  • 举报
回复
codeproject播放mp3的例子,http://www.codeproject.com/Tips/480490/A-Simple-Csharp-Player-Mp3-with-NAudio 至于分十段,这个你获取MP3播放时间长度 请看这个 http://bbs.csdn.net/topics/320114032
kxyzjm62 2015-07-28
  • 打赏
  • 举报
回复
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { int CD; int Wz; int FF; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.axWindowsMediaPlayer1.URL="C:\\Documents and Settings\\Administrator\\桌面\\母亲.mp3"; this.axWindowsMediaPlayer1.Ctlcontrols.stop(); this.timer1.Enabled = false; this.axWindowsMediaPlayer1.Ctlcontrols.play(); this.timer1.Enabled = true; this.timer1.Interval = 10; this.timer2.Enabled = false; this.timer2.Interval = 6000; } private void timer1_Tick(object sender, EventArgs e) { CD =(int) this.axWindowsMediaPlayer1.currentMedia.duration ; FF =(int)this.axWindowsMediaPlayer1.Ctlcontrols.currentPosition; switch (Wz) { case 0: if (FF >= CD / 10) { if (FF != 0) { this.axWindowsMediaPlayer1.Ctlcontrols.pause(); this.timer2.Enabled = true; } } break; case 1: if (FF >= CD / 5) { this.axWindowsMediaPlayer1.Ctlcontrols.pause(); this.timer2.Enabled = true; } break; } } private void timer2_Tick(object sender, EventArgs e) { this.timer2.Enabled = false; Wz = 1; this.axWindowsMediaPlayer1.Ctlcontrols.play(); } } } 大致就这样,其他的自己写吧
失落的神庙 2015-07-28
  • 打赏
  • 举报
回复
mciSendString

111,092

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧