在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
使用MD5的方法比对CXimage里图片是否改变: Delphi7实现方法: uses IdHashMessageDigest function TForm1.GetImageMD5(cxImage: TcxImage): string; var tmpMD5: TIdHashMessageDigest5; ms: TMemoryStream; begin result:=''; if cxImage.Picture.Graphic=nil then exit; tmpMD5:=TIdHashMessageDigest5.Create; ms:= TMemoryStream.Create; try cxImage.Picture.Graphic.SaveToStream(ms); result:=tmpMD5.AsHex(tmpMD5.HashValue(ms)); finally tmpMD5.Free; ms.Free; end; end; Delphi2010实现方法: 1 uses IdHashMessageDigest 2 3 function GetImageMD5(cxImage: TcxImage): string; 4 var 5 tmpMD5: TIdHashMessageDigest5; 6 ms: TMemoryStream; 7 begin 8 result:=''; 9 if cxImage.Picture.Graphic=nil then exit; 10 tmpMD5:=TIdHashMessageDigest5.Create; 11 ms:= TMemoryStream.Create; 12 try 13 cxImage.Picture.Graphic.SaveToStream(ms); 14 ms.Position:=0; 15 result:=tmpMD5.HashStreamAsHex(ms); 16 finally 17 tmpMD5.Free; 18 ms.Free; 19 end; 20 end; 参考:http://www.cnblogs.com/jxsoft/archive/2011/08/08/2131436.html |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论