📄 unit1.pas
字号:
unit Unit1;
interface
uses
Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
SctCtrl, SctVar, AcePage, SctRep, Db, DBTables, ExtCtrls, StdCtrls,
Buttons, SctBtn;
type
TForm1 = class(TForm)
SctReport1: TSctReport;
ReportPage: TSctGrouppage;
ReportHeaderBand: TSctBand;
ReportHeaderBandlevel: TSctLevel;
PageHeaderBand: TSctBand;
PageHeaderBandlevel: TSctLevel;
DetailBand: TSctBand;
DetailBandlevel: TSctLevel;
PageFooterBand: TSctBand;
PageFooterBandlevel: TSctLevel;
ReportFooterBand: TSctBand;
ReportFooterBandlevel: TSctLevel;
DataSource1: TDataSource;
Table1: TTable;
svarDateTime: TSctDateTimeVar;
svarPage: TSctPageVar;
DataSourceGuide: TSctDataSourceGuide;
table1Species_No: TSctDBVar;
table1Category: TSctDBVar;
table1Common_Name: TSctDBVar;
table1Species_Name: TSctDBVar;
table1Length__cm_: TSctDBVar;
table1Length_In: TSctDBVar;
table1Notes: TSctDBVar;
table1Graphic: TSctDBVar;
varlabel: TSctvarlabel;
varlabel1: TSctvarlabel;
SctReportButton1: TSctReportButton;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
varlabel3: TSctvarlabel;
varlabel2: TSctvarlabel;
Sctvarlabel1: TSctvarlabel;
procedure SctReport1BeforePrint(Report: TSctReport);
procedure ReportPageBeforeNewPage(Page: TSctPage;
var DoNewPage: Boolean);
procedure DetailBandBeforePrint(Band: TSctBand);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
MarkYPos, nCols, nColWidth, nCurrCol: Integer;
{$R *.DFM}
procedure TForm1.SctReport1BeforePrint(Report: TSctReport);
begin
DetailBand.KeepTogether := CheckBox1.Checked;
if CheckBox2.Checked then nCols := 3 else nCols := 2;
nColWidth := Report.Page.PageWidth div nCols;
{Optionally, modify label widths based on column width}
varLabel.Width := nColWidth * 19 div 20;
varLabel1.Width := nColWidth * 19 div 20;
nCurrCol := 0;
MarkYPos := -1;
end;
procedure TForm1.ReportPageBeforeNewPage(Page: TSctPage;
var DoNewPage: Boolean);
begin
Inc(nCurrCol);
DoNewPage := (nCurrCol >= nCols);
if DoNewPage then nCurrCol := 0 else Page.yPos := MarkYPos;
Page.xPos := Round(Page.PageSetup.LeftMargin * Page.PixelsPerInch)
+ (nCurrCol * nColWidth);
end;
procedure TForm1.DetailBandBeforePrint(Band: TSctBand);
begin
if MarkYPos = -1 then MarkYPos := Band.Page.YPos;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -