From ae45c7539f8f76bf9635c5248e2d891166e63e89 Mon Sep 17 00:00:00 2001 From: Nathan Fulton Date: Tue, 25 Apr 2017 23:35:44 -0400 Subject: [PATCH] AniMax release image files after opening This keeps image files from being locked to the AniMax process while an image is open in AniMax --- AniMax/XBitmap.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AniMax/XBitmap.cs b/AniMax/XBitmap.cs index 4efbdf9..276afac 100644 --- a/AniMax/XBitmap.cs +++ b/AniMax/XBitmap.cs @@ -139,10 +139,12 @@ namespace SpiffCode strFile); } m_strFileName = strFile; - m_bm = new Bitmap(strFile); + using (var bmTemp = new Bitmap(strFile)) + m_bm = new Bitmap(bmTemp); string strPath = Path.GetDirectoryName(strFile); string strFileName = Path.GetFileName(strFile); - m_bmBlack = new Bitmap(Path.Combine(strPath, "black_" + strFileName)); + using (var bmpTemp = new Bitmap(Path.Combine(strPath, "black_" + strFileName))) + m_bmBlack = new Bitmap(bmTemp); } private void Load8(string strFileName, bool fUseFirstPaletteEntryAsTransparentColor) {