C# 深拷贝 Bitmap对象示例
public static Bitmap DeepClone(this Bitmap bitmap)
{
Bitmap dstBitmap = null;
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, bitmap);
mStream.Seek(0, SeekOrigin.Begin);
dstBitmap = (Bitmap)bf.Deserialize(mStream);
mStream.Close();
}
return dstBitmap;
}