📄 unit1.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "AcePage"
#pragma link "SctBtn"
#pragma link "SctCtrl"
#pragma link "SctRep"
#pragma link "SctVar"
#pragma resource "*.dfm"
TForm1 *Form1;
int MarkYPos, nCols, nColWidth, nCurrCol;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SctReport1BeforePrint(TSctReport *Report)
{
nCols = CheckBox1->Checked ? 3 : 2 ;
DetailBand->NewPage = CheckBox2->Checked;
nColWidth = SctReport1->Page->PageWidth / nCols;
varlabel2->Width = nColWidth - 10;
nCurrCol = 0;
MarkYPos = -1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ReportPageBeforeNewPage(TSctPage *Page,
bool &DoNewPage)
{
nCurrCol++;
DoNewPage = (nCurrCol >= nCols);
if (DoNewPage) {nCurrCol = 0;} else {Page->YPos = MarkYPos;};
Page->XPos = (Page->PageSetup->LeftMargin * Page->PixelsPerInch) + (nCurrCol * nColWidth);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::DetailBandBeforePrint(TSctBand *Band)
{
if (MarkYPos == -1) MarkYPos = Band->Page->YPos;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -