home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Delphi / Duck Report / _SETUP.1 / PPage.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-08-13  |  1.9 KB  |  69 lines

  1. unit PPage;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   DBTables, DREng, StdCtrls, DRList;
  8.  
  9. type
  10.   TFormPrintPage = class(TForm)
  11.     DuckReport: TDuckReport;
  12.     Memo1: TMemo;
  13.     BPreview: TButton;
  14.     procedure BPreviewClick(Sender: TObject);
  15.     procedure DuckReportBeforePrintGroup(Sender: TObject; Canvas: TCanvas;
  16.       RcPaper, RcGroup: TRect; SectionStyle: TDRSectionStyle;
  17.       StField: String);
  18.     procedure DuckReportAfterPrintPage(Sender: TObject; Canvas: TCanvas;
  19.       RcPaper: TRect; lPageCount: Integer);
  20.   private
  21.         bPaint:        Boolean;
  22.      RcDetail:    TRect;
  23.   public
  24.     { Public declarations }
  25.   end;
  26.  
  27. var
  28.   FormPrintPage: TFormPrintPage;
  29.  
  30. implementation
  31.  
  32. {$R *.DFM}
  33. Procedure TFormPrintPage.BPreviewClick(Sender: TObject);
  34. Begin
  35.     bPaint        := FALSE;
  36.   RcDetail        := Rect (-1, -1, -1, -1);
  37.   DuckReport.OpenFile;
  38.     DuckReport.OpenDB;
  39.     DuckReport.Preview;
  40. End;
  41. Procedure TFormPrintPage.DuckReportBeforePrintGroup(Sender: TObject;
  42.   Canvas: TCanvas; RcPaper, RcGroup: TRect; SectionStyle: TDRSectionStyle;
  43.   StField: String);
  44. Begin
  45.     if SectionStyle <> gtDetial Then Exit;
  46.  
  47.   { Find Rect of Detial}
  48.   if (RcDetail.Left = -1) or (RcDetail.Left > RcGroup.Left) Then
  49.         RcDetail.Left    := RcGroup.Left;
  50.   if (RcDetail.Top = -1) or (RcDetail.Top > RcGroup.Top) Then
  51.         RcDetail.Top    := RcGroup.Top;
  52.   if (RcDetail.Right = -1) or (RcDetail.Right < RcGroup.Right) Then
  53.         RcDetail.Right    := RcGroup.Right;
  54.   if (RcDetail.Bottom = -1) or (RcDetail.Bottom < RcGroup.Bottom) Then
  55.         RcDetail.Bottom    := RcGroup.Bottom;
  56. End;
  57. Procedure TFormPrintPage.DuckReportAfterPrintPage(Sender: TObject;
  58.   Canvas: TCanvas; RcPaper: TRect; lPageCount: Integer);
  59. Begin
  60.     Canvas.Pen.Color    := clBlack;
  61.   Canvas.Pen.Width    := 5;
  62.     Canvas.Pen.Style    := psSolid;
  63.   Canvas.Brush.Style    := bsClear;
  64.   Canvas.RoundRect (RcDetail.Left, RcDetail.Top,
  65.       RcDetail.Right, RcDetail.Bottom, 20, 20);
  66. End;
  67.  
  68. End.
  69.