我这里是要比较button的图片是哪一个?(有两个流),然后问了人是要使用流来比较,以下是他给我的参考,
来自:http://blog.csdn.net/eryongyan/article/details/6608355
使用命名空间:using System.IO;
private bool Same(Image image1, Image image2) { MemoryStream ms1 = new MemoryStream(); MemoryStream ms2 = new MemoryStream(); image1.Save(ms1, System.Drawing.Imaging.ImageFormat.Bmp); image2.Save(ms2, System.Drawing.Imaging.ImageFormat.Bmp); byte[] im1 = ms1.GetBuffer(); byte[] im2 = ms2.GetBuffer(); if (im1.Length != im2.Length) return false; else { for (int i = 0; i < im1.Length; i++) if (im1[i] != im2[i]) return false; } return true; }