//--------------------------------------------------------------------------- #include #include #pragma hdrstop #include "CommonPrint.h" #include "common.h" #include "TPSpin.hpp" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "TPSpin" #pragma resource "*.dfm" //--------------------------------------------------------------------------- __fastcall TCommonPrintForm::TCommonPrintForm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TCommonPrintForm::FormClose(TObject *Sender, TCloseAction &Action) { TIniFile *IniFile = new TIniFile(BaseDir + "\\Environment.ini"); if (IniFile) { IniFile->WriteBool("Printer", "Method", cbMethod->ItemIndex); delete IniFile; } } //--------------------------------------------------------------------------- void __fastcall TCommonPrintForm::FormCreate(TObject *Sender) { SetFont(); Caption = IDS_COMMON_PRINTSETUP; for (int i = 0; i < 2; i++) { cbMethod->Items->Strings[i] = IDS_COMMON_PRINTMETHOD + " - " + AnsiString(i+1); } Label1->Caption = IDS_COMMON_PAGE; btnSetup->Caption = IDS_COMMON_SETUP; btnOK->Caption = IDS_COMMON_BUTTONOK; btnCancel->Caption = IDS_COMMON_BUTTONCANCEL; TIniFile *IniFile = new TIniFile(BaseDir + "\\Environment.ini"); if (IniFile) { cbMethod->ItemIndex = IniFile->ReadBool("Printer", "Method", 0); delete IniFile; } } //--------------------------------------------------------------------------- void __fastcall TCommonPrintForm::SetFont(){ SetSmallFont(Font); } //--------------------------------------------------------------------------- void __fastcall TCommonPrintForm::btnSetupClick(TObject *Sender) { PrinterSetup->Execute(); lbPrinter->Caption = IDS_COMMON_PRINTER + " : " + Printer()->Printers->Strings[Printer()->PrinterIndex]; } //--------------------------------------------------------------------------- void __fastcall TCommonPrintForm::FormShow(TObject *Sender) { try{ HDC dc=Printer()->Handle; } catch(...){ return; } lbPrinter->Caption = IDS_COMMON_PRINTER + " : " + Printer()->Printers->Strings[Printer()->PrinterIndex]; } //---------------------------------------------------------------------------