⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acedest.pas

📁 suite component ace report
💻 PAS
字号:
unit AceDest;

{ ----------------------------------------------------------------
  Ace Reporter
  Copyright 1995-1998 SCT Associates, Inc.
  Written by Kevin Maher, Steve Tyrakowski
  ---------------------------------------------------------------- }

interface
{$I ace.inc}
uses
  {$IFDEF WIN32}
    windows,
  {$ELSE}
    winprocs,wintypes,
  {$ENDIF}
  SysUtils, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, acesetup, aceview, Mask, aceprev;

type
  TAcePrintDestination = class(TForm)
    btnPrint: TButton;
    btnCancel: TButton;
    printersetup: TButton;
    Printsetup: TPrinterSetupDialog;
    rangegroup: TGroupBox;
    lbFrom: TLabel;
    lbTo: TLabel;
    lbCopies: TLabel;
    rangeAll: TRadioButton;
    rangeCurrent: TRadioButton;
    rangePages: TRadioButton;
    CollatedCopies: TCheckBox;
    StartRange: TEdit;
    EndRange: TEdit;
    Copies: TEdit;
    procedure printersetupClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure btnPrintClick(Sender: TObject);
    procedure rangePagesClick(Sender: TObject);
    procedure rangeCurrentClick(Sender: TObject);
    procedure rangeAllClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Viewer: TForm;
    Preview: TAcePreview;
    AcePrinterSetup: TAcePrinterSetup;

    StartPage: LongInt;
    EndPage: LongInt;
  end;

implementation

{$R *.DFM}

uses aceutil, sctconst;

procedure TAcePrintDestination.printersetupClick(Sender: TObject);
begin
  if Viewer <> nil then
  begin
    if Viewer.FormStyle = fsStayOnTop then
      SetWindowPos(Viewer.Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
         SWP_NOSIZE or SWP_NOACTIVATE);
  end;

  if FormStyle = fsStayOnTop then
    SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
       SWP_NOSIZE or SWP_NOACTIVATE);

  PrintSetup.Execute;

  if Viewer <> nil then
  begin
    if Viewer.FormStyle = fsStayOnTop then
      SetWindowPos(Viewer.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
         SWP_NOSIZE or SWP_NOACTIVATE);
  end;
  if FormStyle = fsStayOnTop then
    SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
       SWP_NOSIZE or SWP_NOACTIVATE);
end;

procedure TAcePrintDestination.FormShow(Sender: TObject);
begin
  {goPrinter.Caption := LoadStr(SCT_CPrinter);}
  {goScreen.Caption := LoadStr(SCT_CScreen);}
  rangeAll.Caption := LoadStr(SCT_CAll);
  rangePages.Caption := LoadStr(SCT_CPages);
  rangeCurrent.Caption := LoadStr(SCT_CCurrentPage);
  lbFrom.Caption := LoadStr(SCT_CFrom);
  lbTo.Caption := LoadStr(SCT_CTo);
  btnPrint.Caption := LoadStr(SCT_CPrint);
  btnCancel.Caption := LoadStr(SCT_CCancel);
  printersetup.Caption := LoadStr(SCT_CPrinterSetup);
  lbCopies.Caption := LoadStr(SCT_CCopies);
  CollatedCopies.Caption := LoadStr(SCT_CCollated);
  caption := LoadStr(SCT_CDestCaption);
  {destgroup.caption := LoadStr(SCT_CDestinationGroup);}
  rangegroup.caption := LoadStr(SCT_CRangeGroup);

  startrange.text := '';
  endrange.text := '';
  copies.text := inttostr(AcePrinterSetup.copies);
  CollatedCopies.Checked := AcePrinterSetup.CollatedCopies;
  StartPage := 0;
  EndPage := 0;
end;

procedure TAcePrintDestination.btnPrintClick(Sender: TObject);
begin
  AcePrinterSetup.GetData;
  AcePrinterSetup.CollatedCopies := CollatedCopies.Checked;
  AcePrinterSetup.Copies := StrToInt(AceRightTrim(copies.text));
  AcePrinterSetup.SetData;

  if rangeAll.Checked then
  begin
    StartPage := 0;
    EndPage := 0;
  end else if rangeCurrent.Checked then
  begin
    if preview <> nil then StartPage := Preview.Page
    else StartPage := 0;
    EndPage := StartPage;
  end else
  begin
    if AceEmpty(startrange.text) then startrange.text := '0';
    if AceEmpty(endrange.text) then endrange.text := '0';
    StartPage := StrToInt(AceRightTrim(startrange.text));
    EndPage := StrToInt(AceRightTrim(endrange.text));
  end;
  ModalResult := mrOk;
end;

procedure TAcePrintDestination.rangePagesClick(Sender: TObject);
begin
  if Preview <> nil then
  begin
    startrange.text := '1';
    endrange.text := IntToStr(Preview.PageCount);
  end else
  begin
    startrange.text := '';
    endrange.text := '';
  end;
  startrange.enabled := True;
  endrange.enabled := True;
end;

procedure TAcePrintDestination.rangeCurrentClick(Sender: TObject);
begin
  startrange.text := '';
  endrange.text := '';
  startrange.enabled := False;
  endrange.enabled := False;
end;

procedure TAcePrintDestination.rangeAllClick(Sender: TObject);
begin
  startrange.text := '';
  endrange.text := '';
  startrange.enabled := False;
  endrange.enabled := False;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -