基本信息
源码名称:C# 音乐播放器 示例源码(mp3)
源码大小:0.26M
文件格式:.zip
开发语言:C#
更新时间:2018-08-09
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 3 元 
   源码介绍
C#音乐播放器

  OpenFileDialog open = new OpenFileDialog();

            open.Multiselect = true;//设置可以多选
            if (open.ShowDialog() == DialogResult.OK)
            {
                //将歌曲保存到文件
                string t = textBox1.Text;
                if (t == "")//为旧组加新歌
                {
                    //取出旧组的名称,拼成文件名
                    string old = lstLeft.Text ".txt";
                    StreamWriter sw = new StreamWriter(old, true, Encoding.Default);
                    //开写歌
                    string[] files = open.FileNames;
                    foreach (string f in files)
                    {
                        sw.WriteLine(f);
                    }
                    sw.Close();
                }
                else //添加新组,也添加歌曲
                {
                    //清空右边的
                    lstRight.Items.Clear();
                    string newF = t ".txt";
                    //先将t写入到分组文件
                    StreamWriter sfz = new StreamWriter("分组.txt", true, Encoding.Default);
                    sfz.WriteLine(t);
                    sfz.Close();
                    StreamWriter sw = new StreamWriter(newF, true, Encoding.Default);
                    //开写歌
                    string[] files = open.FileNames;
                    foreach (string f in files)
                    {
                        sw.WriteLine(f);
                    }
                    sw.Close();
                   
                }

                //将歌曲显示控件
                string[] fs = open.FileNames;
                foreach (string f in fs)
                {
                    lstRight.Items.Add(f);//添加到右边
                }
                //左边的
                lstLeft.Items.Add(textBox1.Text);
                //清空文本框
                this.textBox1.Text = "";
            }