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

📄 sctdest.pas

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

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

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

type
  TSctReportDestination = class(TForm)
    btnPrint: TButton;
    btnCancel: TButton;
    printersetup: TButton;
    Printsetup: TPrinterSetupDialog;
    destgroup: TGroupBox;
    goPrinter: TRadioButton;
    goScreen: TRadioButton;
    lbCopies: TLabel;
    rangegroup: TGroupBox;
    lbFrom: TLabel;
    lbTo: TLabel;
    rangeAll: TRadioButton;
    rangePages: TRadioButton;
    CollatedCopies: TCheckBox;
    StartRange: TEdit;
    EndRange: TEdit;
    Copies: TEdit;
    procedure printersetupClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure btnPrintClick(Sender: TObject);
    procedure rangeAllClick(Sender: TObject);
    procedure rangePagesClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    PageSetup: TSctPageSetup;
    property PrintDialog: TPrinterSetupDialog read Printsetup write PrintSetup;
  end;

var
  SctReportDestination: TSctReportDestination;

implementation

{$R *.DFM}

uses sctutil, sctconst;

procedure TsctReportDestination.printersetupClick(Sender: TObject);
begin

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

  PrintSetup.Execute;

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

end;

procedure TsctReportDestination.FormShow(Sender: TObject);
begin
  goPrinter.Caption := LoadStr(SCT_CPrinter);
  goScreen.Caption := LoadStr(SCT_CScreen);
  rangeAll.Caption := LoadStr(SCT_CAll);
  rangePages.Caption := LoadStr(SCT_CPages);
  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);

  if Not PageSetup.AnyPrinters then
  begin
    goPrinter.Enabled := False;
    PrinterSetup.Enabled := False;
  end else
  begin
    goPrinter.Enabled := True;
    PrinterSetup.Enabled := True;
  end;

  if PageSetup.Destination = destPrinter then goPrinter.Checked := True
  else goScreen.Checked := True;

  startrange.text := '';
  endrange.text := '';
  if PageSetup.RangeStart > 0 then startrange.text := IntToStr(PageSetup.RangeStart);
  if PageSetup.RangeEnd > 0 then endrange.text := IntToStr(PageSetup.RangeEnd);
  if (PageSetup.RangeStart > 0) or (PageSetup.RangeEnd > 0) then rangePages.Checked := True;
  copies.text := inttostr(PageSetup.copies);
  CollatedCopies.Checked := PageSetup.CollatedCopies;


  if PageSetup.AnyPrinters Then PageSetup.LoadSettings;
end;

procedure TsctReportDestination.btnPrintClick(Sender: TObject);
begin
  if goPrinter.Checked then PageSetup.Destination := destPrinter
  else PageSetup.Destination := destScreen;

  if RangeAll.Checked then
  begin
    PageSetup.rangestart := 0;
    PageSetup.rangeend := 0;
  end else
  begin
    if SctEmpty(StartRange.text) then StartRange.Text := '0';
    if SctEmpty(EndRange.text) then EndRange.Text := '0';

    PageSetup.RangeStart := StrToInt(SctRightTrim(StartRange.Text));
    PageSetup.RangeEnd := StrToInt(SctRightTrim(EndRange.Text));
  end;

  if PageSetup.AnyPrinters Then PageSetup.CopySettings;
  PageSetup.Copies := StrToInt(SctRightTrim(Copies.Text));
  PageSetup.CollatedCopies := CollatedCopies.Checked;
  { need to load settings back to windows so it knows to
    print the correct number of copies. }
  if PageSetup.AnyPrinters Then PageSetup.LoadSettings;
  ModalResult := mrOk;
end;

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

procedure TsctReportDestination.rangePagesClick(Sender: TObject);
begin
  startrange.enabled := True;
  endrange.enabled := True;
  if StartRange.Text = '' then StartRange.Text := '1';
  if EndRange.Text = '' then EndRange.Text := '0';
end;

end.

⌨️ 快捷键说明

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