c# - 泛型发生在 GDI+
问题描述
您好我必须在 C# 中保存图片框中包含的图像,为此我使用下面的代码,但会生成此异常:
gdi+ 在 system.drawing.image.save 处发生一般错误
我该如何解决?
C#代码:
using (MemoryStream m = new MemoryStream())
{
if (pictureBoxFirma.Image != null)
{
const int milliseconds = 2000;
Thread.Sleep(milliseconds);
pictureBoxFirma.Image.Save(m, ImageFormat.Jpeg);
byte[] photo_aray = new byte[m.Length];
m.Position = 0;
m.Read(photo_aray, 0, photo_aray.Length);
utemp.AggionraFirmaUtente(photo_aray, IdUtente);
}
else
{
Console.WriteLine("Errore: inserimento immagine non riuscito");
}
}
解决方案
推荐阅读
- mvvm - Xamarin Forms View 仅在作为代码隐藏中的子项添加时呈现
- r - 计算每列频率的乘积
- javascript - Ember.js 索引不起作用
- c - 读取多个文本文件(或执行两次?)时出现 free() 问题
- android - 从同一布局父级访问元素
- angular - 如何使用angular2显示对话的最后一条消息
- gremlin - TinkerPop:按未连接边缘的边缘过滤
- ruby-on-rails - 如何在 rails_admin 调用中添加参数
- javascript - 错误:无法读取未定义的属性“拆分”
- c++ - 为什么我的 c++ 代码在 Linux 上运行而不在 Windows 上运行,RAM 内存有问题吗?