110,534
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
RichTextBox Rtfbox = new RichTextBox();
Panel pL = new Panel();
pL.Size = new Size(400,400);
pL.Location = new Point(200,350);
pL.AutoScroll = true;
OpenFileDialog ofd = new OpenFileDialog();
ofd.Multiselect = true;//允许同时选择多个文件
ofd.Filter = "bmp文件|*.bmp|png文件|*.png|jpg文件|*.jpg";
if (ofd.ShowDialog() == DialogResult.OK)
{
for (int fi = 0; fi < ofd.FileNames.Length; fi++)
{
Rtfbox.AppendText(ofd.FileNames[fi].ToString() + Environment.NewLine);
PictureBox pB = new PictureBox();
pB.Size = new Size(200, 200);
pB.Location = new Point(0,fi*200);
pB.SizeMode = PictureBoxSizeMode.Zoom;
pB.Image = Image.FromFile(ofd.FileNames[fi].ToString());
pL.Controls.Add(pB);
}
}
Rtfbox.Size = new Size(500,200);
Rtfbox.Location = new Point(200,100);
this.Controls.Add(Rtfbox);
this.Controls.Add(pL);
}