啊,为了拿分再举个例子!(拿TXT举例)
Var
ss : TMemoryStream;
//////////////////////
begin
ss := TMemoryStream.Create;
ss.LoadFromFile('d:/bb.txt');
RichEdit1.Lines.LoadFromStream(ss);
ss.free;
end;
行不?
SanDao
var
ams:tmemorystream;
begin
ams:=tmemorystream.Create ;
if OpenDialog1.Execute then
ams.LoadFromFile(OpenDialog1.FileName);
//image1.Picture.Bitmap.LoadFromStream(ams);
memo1.Lines.LoadFromStream(ams);
end;
但是MEMO1显示的只有 '邢唷?' (我打开的是WORD文件);
一样的呀!
Var
ss : TMemoryStream;
//--------------------
begin
ss := TMemoryStream.Create;
ss.LoadFromFile('d:/0004.BMP');
Image1.Picture.Bitmap.LoadFromStream(ss);
ss.Free;
end;