【发布时间】:2013-03-21 13:48:48
【问题描述】:
我了解此消息的含义(需要对非托管资源执行 Dispose),但我真的不明白为什么会发生这种情况:
System.Drawing.Image imgAnimaha, imgNoanimaha;
using (System.IO.Stream file = thisExe.GetManifestResourceStream("WindowsApplication1.img.noanimaha135.gif"))
{
using (System.Drawing.Image img = Image.FromStream(file))
{
imgNoanimaha = (System.Drawing.Image)img.Clone();
}
}
using (System.IO.Stream file = thisExe.GetManifestResourceStream("WindowsApplication1.img.animaha135.gif"))
{
using (System.Drawing.Image img = Image.FromStream(file))
{
imgAnimaha = (System.Drawing.Image)img.Clone();
}
}
pbDiscovery.Image = imgAnimaha;
在这种情况下,我收到“GDI+ 中发生一般错误”为什么以及如何解决? PS。如果我写以下内容:
pbDiscovery.Image = imgNoanimaha;
它工作正常。 我真的不明白在哪里以及哪些非托管资源没有被释放......
【问题讨论】:
-
你用不同的位图试过这个吗?
标签: c# gdi+ system.drawing