[英]Error in exporting image from picturebox “ A generic error occurred in GDI+. ” C#
从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);
}
代码有什么问题?
您可能需要一个文件名...
pictureBox1.Image.Save(@"C:\Users\Mena\Desktop\file.bmp",
System.Drawing.Imaging.ImageFormat.Bmp);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.