home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 February / Chip_2004-02_cd1.bin / program / delphi / navody / d56 / ec1vr2.exe / #setuppath# / Delphi / Envelopes / Main.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2003-12-09  |  2.9 KB  |  121 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   vivrep20, Menus, Grids, DBGrids, StdCtrls, Buttons, ExtCtrls, Db,
  8.   DBTables, ImgList, ActnList, ComCtrls, ToolWin, ExtDlgs, jpeg;
  9.  
  10. type
  11.   TMainForm = class(TForm)
  12.     MainMenu: TMainMenu;
  13.     FilePrintItem: TMenuItem;
  14.     FilePrintSetupItem: TMenuItem;
  15.     FileExitItem: TMenuItem;
  16.     HelpAboutItem: TMenuItem;
  17.     Preview: TMenuItem;
  18.     N1: TMenuItem;
  19.     LoadPicture1: TMenuItem;
  20.     ClearPicture1: TMenuItem;
  21.     ImageList: TImageList;
  22.     ActionList: TActionList;
  23.     ExitAction: TAction;
  24.     PrintSetupAction: TAction;
  25.     PrintAction: TAction;
  26.     PrintPreviewAction: TAction;
  27.     AboutAction: TAction;
  28.     LoadAction: TAction;
  29.     ClearAction: TAction;
  30.     ToolBar1: TToolBar;
  31.     ToolButton1: TToolButton;
  32.     ToolButton2: TToolButton;
  33.     ToolButton3: TToolButton;
  34.     ToolButton4: TToolButton;
  35.     ToolButton5: TToolButton;
  36.     ToolButton6: TToolButton;
  37.     ToolButton7: TToolButton;
  38.     ToolButton8: TToolButton;
  39.     ToolButton9: TToolButton;
  40.     ToolButton10: TToolButton;
  41.     LoadButton: TSpeedButton;
  42.     SpeedButton1: TSpeedButton;
  43.     TargetsPanel: TPanel;
  44.     FromPanel: TPanel;
  45.     FromLabel: TLabel;
  46.     NologoLabel: TLabel;
  47.     TargetsLabel: TLabel;
  48.     FromEdit: TMemo;
  49.     LogoImage: TImage;
  50.     TargetsGrid: TDBGrid;
  51.     TargetsTable: TTable;
  52.     TargetsSource: TDataSource;
  53.         LoadDialog: TOpenPictureDialog;
  54.  
  55.     procedure ExitActionExecute(Sender: TObject);
  56.     procedure AboutActionExecute(Sender: TObject);
  57.     procedure PrintSetupActionExecute(Sender: TObject);
  58.     procedure PrintActionExecute(Sender: TObject);  
  59.     procedure PrintPreviewActionExecute(Sender: TObject);
  60.     procedure LoadActionExecute(Sender: TObject);
  61.     procedure ClearActionExecute(Sender: TObject);
  62.   private
  63.     { Private declarations }
  64.   public
  65.     { Public declarations }
  66.     constructor Create (AOwner: TComponent); override;
  67.   end;
  68.  
  69. var
  70.   MainForm: TMainForm;
  71.  
  72. implementation
  73.  
  74. uses Rep, About;
  75.  
  76. {$R *.DFM}
  77.  
  78. constructor TMainForm.Create (AOwner: TComponent);
  79. begin
  80.   inherited Create (AOwner);
  81.   TargetsTable.Active:= true;
  82. end;
  83.  
  84. procedure TMainForm.ExitActionExecute(Sender: TObject);
  85. begin
  86.   Close;
  87. end;
  88.  
  89. procedure TMainForm.AboutActionExecute(Sender: TObject);
  90. begin
  91.   AboutBox.ShowModal;
  92. end;
  93.  
  94. procedure TMainForm.PrintSetupActionExecute(Sender: TObject);
  95. begin
  96.   RepForm.VividReport.PrinterSetup;
  97. end;
  98.  
  99. procedure TMainForm.PrintActionExecute(Sender: TObject);  
  100. begin
  101.   if RepForm.VividReport.PrintSetup then RepForm.VividReport.Print;
  102. end;
  103.  
  104. procedure TMainForm.PrintPreviewActionExecute(Sender: TObject);
  105. begin
  106.   RepForm.VividReport.PrintPreview (RepForm.VRPreview);
  107. end;
  108.  
  109. procedure TMainForm.LoadActionExecute(Sender: TObject);
  110. begin
  111.   if LoadDialog.Execute then
  112.     LogoImage.Picture.LoadFromFile (LoadDialog.FileName);
  113. end;
  114.  
  115. procedure TMainForm.ClearActionExecute(Sender: TObject);
  116. begin
  117.   LogoImage.Picture.Assign (nil);
  118. end;
  119.  
  120. end.
  121.