开发者

Delphi - Show modal report with Crystal Reports

I'm using Crystal Reports 7 and Delphi 7 and wondering how to open a modal preview of the report.

Crpe1.Execute;

opens a non 开发者_如何学Cmodal form, but I can't find a way to open a modal one... Thanks for your help!


It's a long time that i didn't work with TCrpe and Delphi7.

I think that you can change the Tcrpe.Output:= toWindow for a preview and Tcrpe.Output:= toPrinter to print direct to the printer.

I don't know exactly because i don't have delphi7 and Tcrpe on my pc.

Use crpe1.show, then you have also preview dialog.


I hope that this example help you to have a showmodal

 procedure Tform1.BtnShowViewerClick(Sender: TObject);
 var
   oForm: TForm;
 begin
   oForm:= TForm.Create(Nil);
   try
     oForm.bordericons:= [bisystemmenu]; 
     oForm.OnResize:= OnCrpeViewerResize; 
     crpe1.WindowParent:= oForm;
     crpe1.Show;
     oForm.ShowModal;
   finally
     FreeAndNil(oForm);
   end;
 end;


 procedure TForm1.OnCrpeViewerResize(Sender: TObject);
 begin
   if (sender is TForm) then
   begin
     SetWindowPos(Crpe1.ReportWindowHandle, 
                  HWND_TOP, 
                  0, 
                  0, 
                  TForm(Sender).ClientWidth,
                  TForm(Sender).ClientHeight, 
                  SWP_NOZORDER);     
   end;
 end;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜