pictureBox1.Image = Image.FromFile("d:\\test.jpg");
代码就是这样,不知为什么你的不行
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image = Image.FromFile("D:\\chart.png");
}
try
{
openFileDialog1.Filter = "JPEG Files (*.jpg)|*.jpg|PNG Files (*.png)|*.png|BMP Files (*.bmp)|*.bmp|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 1;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
pictureBoxPhoto.Load(openFileDialog1.FileName);
}
}
catch
{
MessageBox.Show("图片加载失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}我就这么用的 没问题