2013-06-03 57 views
0

我想創建一個將bmp文件保存到我的圖片\測試的程序。 由於某些未知原因,我得到 - 「在GDI +中發生了一般性錯誤。」 請幫我理解爲什麼這件事發生在我身上。 我的代碼是:將img保存到我的圖片時出現gdi +錯誤

System.Drawing.Image img = Properties.Resources.pic; 
     string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); 
     string path2 = [email protected]"\"+"test"; 
     img.Save(path2, System.Drawing.Imaging.ImageFormat.Bmp); 

回答

0

可以是任何一些事情,但儘量保存圖像的副本:

System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Properties.Resources.pic); 
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); 
string path2 = [email protected]"\"+"test"; 
bmp.Save(path2); 
相關問題