Exemplo n.º 1
0
        /// <summary>
        /// 初始化头像集合
        /// </summary>
        private void AddImageToPanel()
        {
            int        x = 0;
            int        y = 0;
            PictureBox pic;
            int        cs = this.panel1.Width / 60;
            int        yu = this.panel1.Width % 60 / 2;

            x = yu;
            for (int i = 1; i <= 73; i++)
            {
                string name  = "im" + (i);
                Point  point = new Point(x, y);
                Image  image = Method.ReadHeadImage(name);
                pic = this.GetPicBox(name, point, image);
                if ((i) % cs == 0)
                {
                    x  = yu;
                    y += pic.Height + 20;
                }
                else
                {
                    x += pic.Size.Width + 10;
                }
                this.panel1.Controls.Add(pic);
                image = null;
            }
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }