如何显示中文化的打印预览对话框
|
|
|
作者:佚名
来源:InterNet 加入时间:2004-11-23 |
如何显示中文化的打印预览对话框
拷贝C:\Rave5\Source目录中的RpFormPreview.pas和RpFormPreview.dfm到对应的项
目目录中。
把RpFormPreview.pas加入到对应的项目文件中,把对应窗体的名字从
RavePreviewForm更改为SCRavePreviewForm;将文件RpFormPreview.pas另存为
SCFormPreview.pas。
把窗体SCRavePreviewForm中的对应文字从英文更改为中文。
在主窗体上加上 RvProject和 RvSystem部件,通过设定RvProject.Engine为
RvSystem部件来把两者挂接。
设置RvSystem部件的OverridePreview事件过程为以下代码:
procedure TForm1.RvSystem1OverridePreview(ReportSystem: TRvSystem;
OverrideMode: TOverrideMode; var OverrideForm: TForm);
begin
Case OverrideMode Of
omCreate:
Begin
OverrideForm := TSCRavePreviewForm.Create(self);
//OverrideForm.Caption := ReportSystem.TitlePreview;
OverrideForm.Width := ReportSystem.SystemPreview.FormWidth;
OverrideForm.Height := ReportSystem.SystemPreview.FormHeight;
OverrideForm.WindowState := ReportSystem.SystemPreview.FormState;
(OverrideForm As TSCRavePreviewForm).ReportSystem := ReportSystem;
End;
omShow:
Begin
ReportSystem.SystemPreview.InitPreview((OverrideForm As
TSCRavePreviewForm).RvRenderPreview);
If Assigned(ReportSystem.OnPreviewSetup) Then
Begin
ReportSystem.OnPreviewSetup((OverrideForm As
TSCRavePreviewForm).RvRenderPreview);
End; { if }
(OverrideForm As TSCRavePreviewForm).InputFileName :=
ReportSystem.SystemFiler.Filename;
(OverrideForm As TSCRavePreviewForm).InputStream :=
ReportSystem.SystemFiler.Stream;
(OverrideForm As TSCRavePreviewForm).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 TSCRavePreviewForm).RvRenderPreview.NDRStream.Free;
(OverrideForm As TSCRavePreviewForm).RvRenderPreview.NDRStream :=
Nil;
End; { if }
FreeAndNil(OverrideForm);
End;
End; { case }
end;
编译运行这个项目,其打印预览窗口就会变成中文的了!
备注:这种方式进行中文化不会受到RAVE版本升级的影响!
|
[文章录入员:fightter] |
|
|
|
|