在picturebox绘图并保存的问题,下面是保存按钮的代码,不知哪里出问题了
private void button1_Click(object sender, EventArgs e){
saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif|PNG Image|*.png";
saveFileDialog1.Title = "Save";
saveFileDialog1.FileName = string.Empty;
saveFileDialog1.ShowDialog();
if (saveFileDialog1.FileName != "")
{
fs = ()saveFileDialog1.OpenFile();
switch (saveFileDialog1.FilterIndex)
{
case 1:
this.pictureBox1.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
break;
case 2:
this.pictureBox1.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Bmp);
break;
case 3:
this.pictureBox1.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Gif);
break;
case 4:
this.pictureBox1.Image.Save(fs, System.Drawing.Imaging.ImageFormat.Png);
break;
}
fs.Close();
}
}