我正在开发一个Outlook 2010的插件,从一个序列化的XML文件中加载一张图片。图片可以很好地加载,并且可以轻松将其分配给Winform上的pictureBox对象。该对象保存在
[XmlIgnore]
public Bitmap Image
{
get { return this.templateImage; }
set { this.templateImage = value; }
}
当我尝试将物理文件保存到硬盘上时,我正在执行以下操作:
string filePath = Path.Combine(dirPath, item.Id + ".jpg");
try
{
item.Image.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
}
catch (Exception e)
{
Debug.WriteLine("DEBUG::LoadImages()::Error attempting to create image::" + e.Message);
}
我遇到了一个名为"GDI+"的通用错误。我已经检查了文件夹的写入权限,并且确保它有写入权限,但我不确定出了什么问题。我还尝试将ImageFormat更改为bmp、png等格式,以查看是否存在转换问题...但是没有效果。请问有谁能提供一些解决方法吗?