方法一:
//先启动Timer
Timer timer1= new Timer();
timer1.Tick += new EventHandler(Timer_Tick);
timer1.Start();
timer1.Interval=10;
//触发事件
private void Timer_Tick(object sender, EventArgs e)
{
if ((int)MediaPlayer1.playState == 1)//表示状态为停止时
{
if (listBox1.SelectedIndex < listBox1.Items.Count - 1)
listBox1.SelectedIndex = (listBox1.SelectedIndex + 1);
else
if (listBox1.Items.Count > 0)
listBox1.SelectedIndex = 0;
//播放
PlaySong(listBox1.SelectedIndex);
}
//说明此种方法有效,但有一个bug,每次遇到mediaPlayer1.Ctcontrols.Stop()方法,自动播放下一首
方法二:这个方法比较好 自动顺序播放下一首
先设置:timer1.