从pictureBox导出图片时出错
" GDI +"
中发生了一般性错误********** 异常文字 **********
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)
at Soccer_Studio.Form1.button2_Click(Object sender, EventArgs e) in ***********************\Form1.cs:line 137
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
这是我的代码
using (Bitmap tempImage = new Bitmap(pictureBox1.Image))
{
pictureBox1.Image.Save(@"C:\Users\Mena\Desktop", System.Drawing.Imaging.ImageFormat.Bmp);
}
代码中有什么问题?
答案 0 :(得分:2)
您可能需要文件名...
pictureBox1.Image.Save(@"C:\Users\Mena\Desktop\file.bmp",
System.Drawing.Imaging.ImageFormat.Bmp);