110,567
社区成员
发帖
与我相关
我的任务
分享
public Form1()
{
Button b = new Button();
b.Size = new System.Drawing.Size(198, 59);
b.Location = new System.Drawing.Point(1, 1);
b.Text = "ddd";
this.Controls.Add(b);
InitializeComponent();
}
DirectoryInfo picFolder = new DirectoryInfo("pic/");
FileInfo[] files = picFolder.GetFiles();
int j = 0;
for (int i = 0; i < files.Length; i++)
{
if (files[i].Extension == ".jpg")
{
j++;
Panel p = new Panel();
p.Name = "p" + j;
p.Size = new System.Drawing.Size(198, 59);
p.Location = new System.Drawing.Point(1, 1);
PictureBox pbox = new PictureBox();
pbox.Size = new System.Drawing.Size(198, 59);
pbox.Location = new System.Drawing.Point(1, 1);
pbox.Image = Image.FromFile("pic/" + files[i].Name);
this.Controls.Add(p);
}
}
Button b = new Button();
b.Size = new System.Drawing.Size(198, 59);
b.Location = new System.Drawing.Point(1, 1);
b.Text = "ddd";
this.Controls.Add(b);