4
我想從文件夾中刪除我的圖像。但它會拋出「它正在被另一個進程使用。」圖像文件正在被另一個進程使用
這裏是我的代碼:
fuProductImage.SaveAs(fileFolderPathTemp + fuProductImage.FileName);
Bitmap orgImage = new Bitmap(fileFolderPathTemp + fuProductImage.FileName);
ResizeAndSaveImages(orgImage, fileFolderPathLarge, fuProductImage.FileName, 66, 66);
File.Delete(fileFolderPathTemp + fuProductImage.FileName);
我應該怎麼做刪除這個文件?
把一些'使用'放在第二行:'使用(位圖orgImage =新的位圖(fileFolderPathTemp + fuProductImage.FileName)){/ *這裏只有第3行。 * /}'。 –
@UweKeim謝謝。它工作得很好。你能再次寫作答案嗎?因爲很多人沒有檢查沒有答案的問題。再一次非常感謝你。 – cagin