定义自己的预览窗体 要 在RvSystem1 的overridepreview 事件里写代码,
procedure TDM.RvSystem1OverridePreview(ReportSystem: TRvSystem;
OverrideMode: TOverrideMode;
var OverrideForm: TForm);
begin
Case OverrideMode Of
omCreate:
begin
OverrideForm := TMyPreviewForm.Create(self);
//创建预览窗体
OverrideForm.Caption := ReportSystem.TitlePreview;
OverrideForm.Width := ReportSystem.SystemPreview.FormWidth;
OverrideForm.Height := ReportSystem.SystemPreview.FormHeight;
OverrideForm.WindowState := ReportSystem.SystemPreview.FormState;
(OverrideForm As TMyPreviewForm).ReportSystem := ReportSystem;
end;
omShow:
begin
ReportSystem.SystemPreview.InitPreview((OverrideForm As TMyPreviewForm).RvRenderPreview);
If Assigned(ReportSystem.OnPreviewSetup) then
begin
ReportSystem.OnPreviewSetup((OverrideForm As TMyPreviewForm).RvRenderPreview);
end;
{ if }
(OverrideForm As TMyPreviewForm).InputFileName := ReportSystem.SystemFiler.Filename;
(OverrideForm As TMyPreviewForm).InputStream := ReportSystem.SystemFiler.Stream;
(OverrideForm As TMyPreviewForm).InitFromRPSystem;
If soPreviewModal In ReportSystem.SystemOptions then
begin
OverrideForm.ShowModal;
End
else
begin
OverrideForm.Show;
end;
{ else
}
end;
omWait:
begin
If Not (soPreviewModal In ReportSystem.SystemOptions) then
begin
// Wait for close
Repeat
Sleep(250);
Application.ProcessMessages;
Until Not OverrideForm.Visible;
end;
{ if }
end;
omFree:
begin
If (ReportSystem.SystemFiler.StreamMode In [smTempFile, smFile]) then
begin
(OverrideForm As TMyPreviewForm).RvRenderPreview.NDRStream.Free;
(OverrideForm As TMyPreviewForm).RvRenderPreview.NDRStream := Nil;
end;
{ if }
FreeAndNil(OverrideForm);
end;
end;
{ case }
end;