F
fxh7622
Unregistered / Unconfirmed
GUEST, unregistred user!
我使用TVCLZip对一个BMP进行压缩,压缩完以后有对这个压缩后的文件解压缩。解压缩以后想将这个BMP图片放在一个TImage控件中,可是发现怎么也放不上去。请哪位大侠帮助。一下是我的代码:
压缩:
procedure TForm1.Button1Click(Sender: TObject);
var
InStream,OutStream:TFileStream;
Size:Integer;
begin
InStream:=TFileStream.Create('C:/test.bmp',fmOpenRead);
Size:=InStream.Size;
OutStream:=TFileStream.Create('C:/11111.zip',fmCreate);
OutStream.Seek(0,soFromEnd);
Size:=OutStream.Size;
VCLZip1.ZLibCompressStream(InStream,OutStream);
Size:=OutStream.Size;
OutStream.Free;
InStream.Free;
end;
解压缩:
procedure TForm1.Button2Click(Sender: TObject);
var
InStream,OutStream:TFileStream;
FOutMem:TMemoryStream;
Ini:TMemIniFile;
begin
InStream:=TFileStream.Create('C:/11111.zip',fmOpenRead);
FOutMem:=TMemoryStream.Create;
VCLZip1.ZLibDecompressStream(InStream,FOutMem);
Image1.Picture.Bitmap.LoadFromStream(FOutMem);
end;
压缩:
procedure TForm1.Button1Click(Sender: TObject);
var
InStream,OutStream:TFileStream;
Size:Integer;
begin
InStream:=TFileStream.Create('C:/test.bmp',fmOpenRead);
Size:=InStream.Size;
OutStream:=TFileStream.Create('C:/11111.zip',fmCreate);
OutStream.Seek(0,soFromEnd);
Size:=OutStream.Size;
VCLZip1.ZLibCompressStream(InStream,OutStream);
Size:=OutStream.Size;
OutStream.Free;
InStream.Free;
end;
解压缩:
procedure TForm1.Button2Click(Sender: TObject);
var
InStream,OutStream:TFileStream;
FOutMem:TMemoryStream;
Ini:TMemIniFile;
begin
InStream:=TFileStream.Create('C:/11111.zip',fmOpenRead);
FOutMem:=TMemoryStream.Create;
VCLZip1.ZLibDecompressStream(InStream,FOutMem);
Image1.Picture.Bitmap.LoadFromStream(FOutMem);
end;