C#动态生成PictureBox并指定图片

 

C#动态生成PictureBox并指定图片:

int Num = 0;
            PictureBox[] pb;
            Num = 6;
            pb = new PictureBox[Num];
            for (int i = 1; i < Num; i++)
            {
                pb[i] = new System.Windows.Forms.PictureBox();
                pb[i].BorderStyle = BorderStyle.FixedSingle;
                pb[i].Location = new Point(50 + i * 110, 100);
                pb[i].SizeMode = PictureBoxSizeMode.Zoom;
                pb[i].Image = Image.FromFile(@"D:\pic\" + i + ".png");
                FlowPanel1.Controls.Add(pb[i]);

            }

C#动态生成PictureBox并指定图片_第1张图片

你可能感兴趣的:(C#动态生成PictureBox并指定图片)