難道這還不夠:在表達式中創建的圖像是否立即生成?
using (Graphics g = Graphics.FromImage(image))
{
g.DrawImage(newImage.GetThumbnailImage(10, 10, null, new IntPtr()), 3, 3, 10, 10);
}
或者我應該使用:
using (Graphics g = Graphics.FromImage(image))
{
using (Image i = newImage.GetThumbnailImage(10, 10, null, new IntPtr()))
{
g.DrawImage(i, 3, 3, 10, 10);
}
}
編輯: 可有人請添加一些MS參考,即使是沒有創建的變量 - 的資源不會被釋放立即?