WinForm的資源檔案中,將PictureBoxImage屬性等非文字內容都轉變成文本保存,這是通過序列化(Serialization)實現的,
Eg:
1將圖片保存至一個XML文件using System.Runtime.Serialization.Formatters.Soap;
2將圖片保存至一個XML文件Stream stream = new FileStream("D:\\Image.xml",FileMode.Create,FileAccess.Write,FileShare.None);
3將圖片保存至一個XML文件SoapFormatter f = new SoapFormatter();
4將圖片保存至一個XML文件Image img = Image.FromFile("D:\\Image.bmp");
5將圖片保存至一個XML文件f.Serialize(stream,img);
6將圖片保存至一個XML文件stream.Close();

相关文章: