コード例 #1
0
ファイル: DownLoadSong.cs プロジェクト: weinre/LSkinMusicPlay
        public void add(Song s)
        {
            //仅显示7个已经下载歌曲
            if (i > 7)
            {
                i = 0;
                panel1.Controls.Clear();
            }
            //px.Visible = true;
            panel1.AutoScroll = false;

            Label l = new Label();

            l.Location     = new Point(0, 0);
            l.Size         = new System.Drawing.Size(width, heitht);
            l.Tag          = s;
            l.TextAlign    = ContentAlignment.MiddleLeft;
            l.ForeColor    = Color.White;
            l.DoubleClick += new EventHandler(label_Clsick);
            l.Text         = s.Filename;



            Panel p1 = new Panel();

            p1.BackColor = Color.FromArgb(119, 203, 63);
            p1.Location  = new Point(x, i * y);
            p1.Size      = new System.Drawing.Size(0, heitht);
            p1.Controls.Add(l);
            panel1.Controls.Add(p1);
            Panel p2 = new Panel();

            p2.BackColor = Color.White;
            p2.Location  = new Point(x, i * y);
            p2.Size      = new System.Drawing.Size(width, heitht);



            Label bfb = new Label();

            bfb.Location  = new Point(width + 1, i * y);
            bfb.Size      = new System.Drawing.Size(68, heitht);
            bfb.TextAlign = ContentAlignment.MiddleLeft;
            bfb.ForeColor = Color.White;
            bfb.BackColor = Color.Transparent;
            bfb.Text      = "100%";
            panel1.Controls.Add(bfb);

            panel1.Controls.Add(p2);
            DownLoad d = new DownLoad();

            d.d    = this;
            d.blue = p1;
            d.gray = p2;
            // d.btn = this.button2;
            d.s = s;

            kugou  k        = new kugou();
            http   h        = new http();
            String url      = k.getinfo(s.Hash);
            String JsonText = h.getJsonText(url);
            String src      = h.getUrl(JsonText);

            panel1.AutoScroll = true;
            //d.px = px;
            d.lb = bfb;
            d.Down(src, Path + s.Filename + "." + s.Extname);
            i++;
        }