OpenFileDialog打开图像文件(*.jpg;*.gif;*.bmp)并读入picturebox中?

如题所述

private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "图像文件(*.jpg;*.gif;*.bmp)|*.jpg;*.gif;*.bmp";
if (ofd.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = Image.FromFile(ofd.FileName);
}
}
温馨提示:答案为网友推荐,仅供参考
相似回答