请教一个的FastReport问题!!!(50分)

  • 主题发起人 主题发起人 hj6
  • 开始时间 开始时间
H

hj6

Unregistered / Unconfirmed
GUEST, unregistred user!
我想在FastReport中动态的载入一幅图片,所以写了如下代码:
procedure TForm1.Button1Click(Sender: TObject);
var
//tempStream:TStringStream;
page:TfrPage;
b :TfrPictureView;
begin
frReport1.Pages.Clear;
frReport1.Pages.Add;
Page := frReport1.Pages[0];
b := TfrPictureView(frCreateObject(gtPicture, ''));
b.SetBounds(20,20,400,400);//一定要指定图象的显示位置及大小,否则没有图象显示。
b.BlobType:=1;
//图象的显示类型为JPG
b.Picture.LoadFromFile('c:/1.jpg');
//tempStream:=TStringStream.Create('');
//b.LoadFromStream(tempStream);
Page.Objects.Add(b);
frReport1.ShowReport;
end;
用LoadFromFile可以实现,但是现在要求用TStringStream来实现,也就是我用//注释的几
句,不知该如何写,请大家指教。谢谢!!!
 
function ComponentToString(Component: TComponent): string;
var
BinStream:TMemoryStream;
StrStream: TStringStream;
s: string;
begin
BinStream := TMemoryStream.Create;
try
StrStream := TStringStream.Create(s);
try
BinStream.WriteComponent(Component);
BinStream.Seek(0, soFrombegin
ning);
ObjectBinaryToText(BinStream, StrStream);
StrStream.Seek(0, soFrombegin
ning);
Result:= StrStream.DataString;
finally
StrStream.Free;
end;
finally
BinStream.Free
end;
end;

这是delphi的帮助![:D]
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
432
import
I
后退
顶部