本帖最后由 念念念念_、 于 2013-9-10 16:46 编辑
添加文件后,播放不了。这个问题。不知道怎么解决
添加音乐文件可以播放,但是添加文件夹后,点击播放的时候就是准备就绪。不能播放。这个问题怎么回事
- <P> private void 文件夹ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- fbd.Description = "请选择文件夹";
- fbd.RootFolder = Environment.SpecialFolder.MyComputer;
- if (fbd.ShowDialog() != DialogResult.OK)
- {
- return;
- }
- else
- {
- string path = fbd.SelectedPath;
- string[] files = Directory.GetFiles(path, "*.mp3", SearchOption.AllDirectories);
- foreach(string file in files)
- {
- string[] songsFile = file.Split('\\', '.');
- SongList.Add(songsFile[songsFile.Length - 2].ToString()); //想问下这样添加对不对 ?????
- SongslistBox.Items.Add(songsFile[songsFile.Length-2].ToString());
- }
- }
- }</P>
复制代码- #region 定义一个播放歌曲的方法 void play(int i)
- private void play(int i)
- {
- timer1.Start();
- axMediaPlayer.URL = SongList[i];
- SongslistBox.SelectedIndex = i;
- axMediaPlayer.Ctlcontrols.play();
- btnPlay.Text = "暂停";
- InLrc(axMediaPlayer.currentMedia.sourceURL);
- lblrc1.Text = "";
- lblrc2.Text = "";
- lblrc3.Text = "";
- }
- private void play()
- {
- //play(0);默认播放列表第一首
- play(SongslistBox.SelectedIndex);
- }
- #endregion
复制代码 |
|