pagesetup.cpp
来自「一个以前收集的基于C/S架构的ERP客户端源代码」· C++ 代码 · 共 113 行
CPP
113 行
//---------------------------------------------------------------------------
#include <vcl.h>
#include "PageSetup.h"
//---------------------------------------------------------------------------
#pragma hdrstop
#pragma package(smart_init)
#pragma link "CSPIN"
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma link "cspin"
#pragma resource "*.dfm"
TfrmPageSetup *frmPageSetup;
//---------------------------------------------------------------------------
__fastcall TfrmPageSetup::TfrmPageSetup(TComponent* Owner, TF1Book6 * AFormula)
: TForm(Owner)
{
Formula = AFormula;
}
//---------------------------------------------------------------------------
void __fastcall TfrmPageSetup::FormShow(TObject *Sender)
{
//ps = Formula->GetPageSetup();
rbHorizontal->Checked = Formula->PrintLandscape;
ceZoom->Value = Formula->PrintScale;
rbAdjust->Checked = Formula->PrintScaleFitToPage;
cePageWidth->Value = Formula->PrintScaleFitHPages;
cePageHeight->Value = Formula->PrintScaleFitVPages;
//scPaper->ItemIndex = ps->PaperSize;
//rbPageNoAuto->Checked = ps->AutoPageNumber;
//ceFirstPageNo->Value = ps->FirstPageNumber;
seTop->Text = FloatToStrF(Formula->PrintTopMargin * 2.54, ffGeneral, 1, 10);
seBottom->Text = FloatToStrF(Formula->PrintBottomMargin * 2.54, ffGeneral, 1, 10);
seLeft->Text = FloatToStrF(Formula->PrintLeftMargin * 2.54, ffGeneral, 1, 10);
seRight->Text = FloatToStrF(Formula->PrintRightMargin * 2.54, ffGeneral, 1, 10);
seTopt->Text = FloatToStrF(Formula->PrintHeaderMargin * 2.54, ffGeneral, 1, 10);
seBottomb->Text = FloatToStrF(Formula->PrintFooterMargin * 2.54, ffGeneral, 1, 10);
cbCenterHor->Checked = Formula->PrintHCenter;
cbCenterVer->Checked = Formula->PrintVCenter;
eCaption->Text = Formula->PrintHeader;
eEnd->Text = Formula->PrintFooter;
}
//---------------------------------------------------------------------------
void __fastcall TfrmPageSetup::bbOkClick(TObject *Sender)
{
Formula->PrintLandscape = rbHorizontal->Checked;
if(rbZoom->Checked)
{
Formula->PrintScaleFitToPage = false;
Formula->PrintScale = ceZoom->Value;
}
else
{
Formula->PrintScaleFitToPage = true;
Formula->PrintScaleFitHPages = cePageWidth->Value;
Formula->PrintScaleFitVPages = cePageHeight->Value;
}
/*
scPaper->ItemIndex = ps->PaperSize;
if(!rbPageNoAuto->Checked)
{
ps->FirstPageNumber = ceFirstPageNo->Value;
}
*/
Formula->PrintTopMargin = StrToFloat(seTop->Text) * 0.3937;
Formula->PrintBottomMargin = StrToFloat(seBottom->Text) * 0.3937;
Formula->PrintLeftMargin = StrToFloat(seLeft->Text) * 0.3937;
Formula->PrintRightMargin = StrToFloat(seRight->Text) * 0.3937;
Formula->PrintHeaderMargin = StrToFloat(seTopt->Text) * 0.3937;
Formula->PrintFooterMargin = StrToFloat(seBottomb->Text) * 0.3937;
Formula->PrintHCenter = cbCenterHor->Checked;
Formula->PrintVCenter = cbCenterVer->Checked;
Formula->PrintHeader = WideString(eCaption->Text);
Formula->PrintFooter = WideString(eEnd->Text);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPageSetup::seTopEnter(TObject *Sender)
{
FBkValue = ((TSDEdit*)(Sender))->Text;
}
//---------------------------------------------------------------------------
void __fastcall TfrmPageSetup::seTopChange(TObject *Sender)
{
try
{
((TSDEdit*)(Sender))->Text.ToDouble();
}
catch(...)
{
((TSDEdit*)(Sender))->Text = FBkValue;
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmPageSetup::rbZoomClick(TObject *Sender)
{
if(rbZoom->Checked)
{
ceZoom->Enabled = true;
cePageWidth->Enabled = false;
cePageHeight->Enabled = false;
}
else
{
ceZoom->Enabled = false;
cePageWidth->Enabled = true;
cePageHeight->Enabled = true;
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?