Delphi以二进制方式读取图片并显示出来


procedure TForm1.BitBtn1Click(Sender: TObject);
var
StringStream : TStringStream;
FSize : integer;
FileData : string;
i : integer;
DataStr : string;
msStream: TMemoryStream;
begin

  msStream:= TMemoryStream.Create;
  self.img1.Picture.Graphic.SaveToStream(msStream);
  msStream.Position:=0;
  StringStream := TStringStream.Create(EmptyStr);
  fsize:=msStream.Size;
  StringStream.CopyFrom(msStream, FSize);
  FileData := StringStream.DataString;
  self.ProgressBar1.Max:=StringStream.Size;
  DataStr := EmptyStr;
  for i := 1 to Length(FileData) do
  begin
  DataStr := DataStr + InttoHex(Ord(FileData[i]), 2); // 十六进制显示
// DataStr:=DataStr+er(Ord(FileData[i]),7)// 二进制显示
  self.ProgressBar1.Position:=i;
  Application.ProcessMessages ;
  end;
  //Memo1.Text:=DataStr;
  self.RichEdit1.Text:=DataStr;
  Application.ProcessMessages ;

end;

联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678