//加载图片
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "选择一个图片";
dlg.Filter = "jpg files(*.jpg)|*.jpg";
if (dlg.ShowDialog() == DialogResult.OK)
{
Bitmap tempBit = new Bitmap(dlg.OpenFile());
pictureBox1.Image = new Bitmap(tempBit, 240, 220);
}
oldpath=dlg.FileName;
dlg.Dispose();
}我现在想在button2_Click取消加载在pictureBox1控件上的图片,让pictureBox1显示空,也就是为加载图片的状态。
pictrueBox.image=null;