WinForm的资源文件中,将PictureBox的Image属性等非文字内容都转变成文本保存,这是通过序列化(Serialization)实现的,例子:
//using System.Runtime.Serialization.Formatters.Soap; Stream stream = new FileStream("E://Image.xml",FileMode.Create,FileAccess.Write,FileShare.None); SoapFormatter f = new SoapFormatter(); Image img = Image.FromFile("E://Image.bmp"); f.Serialize(stream,img); stream.Close(); |