axWindowsMediaPlayer1.Url=ListBox1.SelectedIndex.Tostring();
不行啊...
我是新手请大哥帮下
播放完后
axWindowsMediaPlayer1.Url = ListBox1.Items[i++].tostring();
需要用一個timer,在wmppsMediaEnded的時候執行一次就好了
賦新地址不能播放的,貌似當初我搞了半天,後來用timer才接著放的
private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
listBox2 .SelectedIndex++;
axWindowsMediaPlayer1.URL = listBox2.SelectedIndex.ToString();
}
为什么这样也不行?
private void timer1_Tick(object sender, EventArgs e)
{
listBox2 .SelectedIndex++;
axWindowsMediaPlayer1.URL = listBox2.SelectedIndex.ToString();
}
裡面要 timer1.enable=false;
private void WindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e) { int SelectOne; if (listBox1.SelectedIndex < 0) SelectOne = 1; else SelectOne = listBox1.SelectedIndex + 1; if (listBox1.Items.Count < 0) listBox1.SelectedIndex = 0; if (WindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsStopped) { SelectOne++; WindowsMediaPlayer1.URL = playList[SelectOne]; } }