【发布时间】:2011-12-30 03:33:05
【问题描述】:
我尝试将jpg图像转换为矢量格式。我尝试实现此代码,但它是通过异常
public void Run()
{
Control c = new Control();
Graphics grfx = c.CreateGraphics();
//ReadImage(ImageName) method return the Image to Byte Array
MemoryStream ms = new MemoryStream(ReadImage(@"E:\Temp\1.jpg"));
IntPtr ipHdc = grfx.GetHdc();
Metafile mf = new Metafile(ms,ipHdc);
grfx.ReleaseHdc(ipHdc);
grfx.Dispose();
grfx = Graphics.FromImage(mf);
mf.Save(@"E:\Temp\file.wmf", ImageFormat.Wmf);//Get Exception on this line
grfx.Dispose();
}
异常是:GDI+ 中发生一般错误。 请验证我的代码在哪里出错。 提前致谢
【问题讨论】:
-
而异常是在哪一行源码中抛出的?
-
在这条线上我得到了异常 mf.Save(@"E:\Temp\file.wmf", ImageFormat.Wmf);