Y
yucy
Unregistered / Unconfirmed
GUEST, unregistred user!
如何将*.jpg文件先送TMemoryStream,然后在显示在image中[不要求直接显示]
var
AJPEG: TJPEGImage;
mem : TMemoryStream;
bitmap: TBitMap;
procedure TForm1.Button1Click(Sender: TObject);
var
x,y:integer;
begin
bitmap:=TBitMap.Create;
mem:=TMemoryStream.Create;
AJpeg:=TJpegImage.Create;
//AJpeg.LoadFromFile('d:/d_jpg/71.jpg');
//Form1.Canvas.Rectangle(2,2,560,430);
//x:=10; y:=10;
//Form1.Canvas.Draw(x,y,AJpeg);
mem.Clear;
mem.Position := 0;
mem.LoadFromFile('d:/d_jpg/75.jpg');
image1.Picture.Bitmap.LoadFromStream(mem); //问题出在该句
bitmap.free;
mem.Free;
AJpeg.Free;
end;
var
AJPEG: TJPEGImage;
mem : TMemoryStream;
bitmap: TBitMap;
procedure TForm1.Button1Click(Sender: TObject);
var
x,y:integer;
begin
bitmap:=TBitMap.Create;
mem:=TMemoryStream.Create;
AJpeg:=TJpegImage.Create;
//AJpeg.LoadFromFile('d:/d_jpg/71.jpg');
//Form1.Canvas.Rectangle(2,2,560,430);
//x:=10; y:=10;
//Form1.Canvas.Draw(x,y,AJpeg);
mem.Clear;
mem.Position := 0;
mem.LoadFromFile('d:/d_jpg/75.jpg');
image1.Picture.Bitmap.LoadFromStream(mem); //问题出在该句
bitmap.free;
mem.Free;
AJpeg.Free;
end;