多圖片開啟

//讀圖檔

for (int x = 0; x <= openFileDialog1.FileNames.Length - 1; x++)
{
{
PictureBox p = new PictureBox();

try
{
//p.Load(this.openFileDialog1.FileNames[x]);
//picture.name = this.openFileDialog1.FileNames[x];
p.Image = Image.FromFile(openFileDialog1.FileNames[x]);//<<<這邊有更動
}
catch (Exception ex)
{
p.Image = p.ErrorImage;
}

p.SizeMode = PictureBoxSizeMode.StretchImage;


//============================
p.BackColor = Color.White;
p.Padding = new Padding(2);
p.BorderStyle = BorderStyle.Fixed3D;


p.MouseEnter += new EventHandler(p_MouseEnter);
p.MouseLeave += new EventHandler(p_MouseLeave);
//p.Click += new EventHandler(p_Click);


this.flowLayoutPanel1.Controls.Add(p);
}
}



張貼留言

0 留言