Esempio n. 1
0
File: Form1.cs Progetto: SIRAbae/WFP
        //출력
        private void PlintSearchList()
        {
            panel1.Controls.Clear();
            x = 0;
            y = 0;

            Loading lo = new Loading();

            lo.Function = (() =>
            {
                for (int i = 0; i < bd.buydateList.Count; i++)
                {
                    string filepath = bd.buydateList[i].Image;
                    byte[] data = new System.Net.WebClient().DownloadData(filepath);
                    System.IO.MemoryStream ms = new System.IO.MemoryStream(data);
                    Image img = Image.FromStream(ms);

                    shopingItem item =
                        new shopingItem(img, bd.buydateList[i].Title,
                                        bd.buydateList[i].Lprice.ToString(),
                                        bd.buydateList[i].Link.ToString(),
                                        this);

                    this.Invoke(new MethodInvoker(
                                    delegate()
                    {
                        panel1.Controls.Add(item);
                    }
                                    )
                                );

                    if (x == 0 && y == 0)
                    {
                        this.Invoke(new MethodInvoker(
                                        delegate()
                        {
                            item.Location = new System.Drawing.Point(x, y + 10);
                        }
                                        )
                                    );
                        x = item.Location.X;
                        y = item.Location.Y;
                    }
                    else
                    {
                        this.Invoke(new MethodInvoker(
                                        delegate()
                        {
                            item.Location = new System.Drawing.Point(x, y + 150);
                        }
                                        )
                                    );
                        x = item.Location.X;
                        y = item.Location.Y;
                    }

                    item.num.Text = (i + 1).ToString();
                }
            });
            lo.ShowDialog();
        }