home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 February / Chip_2004-02_cd1.bin / program / delphi / navody / d56 / ec1vr2.exe / #setuppath# / CB5 / Prntext / Main.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2003-12-09  |  2.0 KB  |  59 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Main.h"
  6. #include "About.h"
  7. #include "Report.h"
  8. //---------------------------------------------------------------------------
  9. #pragma resource "*.dfm"
  10. TMainForm *MainForm;
  11. //---------------------------------------------------------------------------
  12. __fastcall TMainForm::TMainForm(TComponent* Owner)
  13.     : TForm(Owner)
  14. {
  15. }
  16. //----------------------------------------------------------------------------
  17. void __fastcall TMainForm::FileOpen(TObject *Sender)
  18. {
  19.   if (OpenDialog->Execute())
  20.   {
  21.     Caption = "Print Text Example - " + OpenDialog->FileName;
  22.     RichEdit1->Lines->LoadFromFile (OpenDialog->FileName);
  23.  
  24.     RepForm->VividReport->ReportTitle = OpenDialog->FileName;
  25.     ((TAbsRichText *)RepForm->VRLabel3->Data)->RichText->LoadFromFile (OpenDialog->FileName);
  26.     SpeedButton2->Enabled = (((TAbsRichText *)RepForm->VRLabel3->Data)->TextLength != 0);
  27.     SpeedButton6->Enabled = SpeedButton2->Enabled;
  28.   }
  29. }
  30. //----------------------------------------------------------------------------
  31. void __fastcall TMainForm::FilePrint(TObject *Sender)
  32. {
  33.   if (RepForm->VividReport->PrintSetup ())
  34.   {
  35.     RepForm->VividReport->Print ();
  36.   }
  37. }
  38. //----------------------------------------------------------------------------
  39. void __fastcall TMainForm::FilePrintSetup(TObject *Sender)
  40. {
  41.   RepForm->VividReport->PrinterSetup ();
  42. }
  43. //----------------------------------------------------------------------------
  44. void __fastcall TMainForm::FileExit(TObject *Sender)
  45. {
  46.   Close();
  47. }
  48. //----------------------------------------------------------------------------
  49. void __fastcall TMainForm::HelpAbout(TObject *Sender)
  50. {
  51.   AboutBox->ShowModal ();
  52. }
  53. //----------------------------------------------------------------------------
  54. void __fastcall TMainForm::PreviewClick(TObject *Sender)
  55. {
  56.   RepForm->VividReport->PrintPreview (RepForm->VRPreview);
  57. }
  58. //---------------------------------------------------------------------------
  59.