1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
{*****************************************}
{ }
{ FastReport v2.3 }
{ Print dialog }
{ }
{ Copyright (c) 1998-99 by Tzyganenko A. }
{ }
{*****************************************}
unit LR_PrDlg;
interface
{$I LR_Vers.inc}
uses
Classes, SysUtils, LResources,
Forms, Controls, Graphics, Dialogs,
Buttons, StdCtrls,LCLIntf,ExtCtrls, Spin,
PrintersDlgs;
type
{ TfrPrintForm }
TfrPrintForm = class(TForm)
cbCollate: TCheckBox;
Label1: TLabel;
GroupBox2: TGroupBox;
RB1: TRadioButton;
RB2: TRadioButton;
RB3: TRadioButton;
E2: TEdit;
Label2: TLabel;
OkButton: TButton;
CancelButton: TButton;
GroupBox1: TGroupBox;
CB1: TComboBox;
PropButton: TButton;
PrinterSetupDialog1: TPrinterSetupDialog;
Image1: TImage;
E1: TSpinEdit;
procedure CB1DrawItem({%H-}Control: TWinControl; Index: Integer;
ARect: TRect; {%H-}State: TOwnerDrawState);
procedure FormCreate(Sender: TObject);
procedure PropButtonClick(Sender: TObject);
procedure CB1Click(Sender: TObject);
procedure E2Click(Sender: TObject);
procedure RB3Click(Sender: TObject);
procedure FormDeactivate(Sender: TObject);
private
{ Private declarations }
OldIndex: Integer;
public
{ Public declarations }
end;
var
frPrintForm: TfrPrintForm;
implementation
{$R *.lfm}
uses LR_Const, LR_Prntr,Printers;
procedure TfrPrintForm.FormCreate(Sender: TObject);
begin
CB1.Items.Assign(Printer.Printers);
CB1.ItemIndex := Printer.PrinterIndex;
OldIndex := Printer.PrinterIndex;
Caption := sPrintFormPrint;
GroupBox1.Caption := sPrintFormPrinter;
PropButton.Caption := sPrintFormProp;
Label1.Caption := sPrintFormCopy;
GroupBox2.Caption := sPrintFormPgRange;
RB1.Caption := sPrintFormAll;
RB2.Caption := sPrintFormCurPg;
RB3.Caption := sPrintFormNumber;
Label2.Caption := sPrintFormInfo;
OkButton.Caption := sOk;
CancelButton.Caption := sCancel;
cbCollate.Caption:=sPrintFormCollate;
{$IFDEF PRINTDIALOG_DISABLE_PRINTER_PROPERTIES}
propButton.Enabled := false;
{$ENDIF}
end;
procedure TfrPrintForm.FormDeactivate(Sender: TObject);
begin
if ModalResult <> mrOk then
Prn.PrinterIndex := OldIndex;
end;
procedure TfrPrintForm.CB1DrawItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
var
r: TRect;
begin
r := ARect;
r.Right := r.Left + 18;
r.Bottom := r.Top + 16;
OffsetRect(r, 2, (ARect.Bottom - ARect.Top) div 2 - 8);
with CB1.Canvas do
begin
FillRect(ARect);
BrushCopy(r, Image1.Picture.Bitmap, Rect(0, 0, 18, 16), clOlive);
TextOut(ARect.Left + 24, ARect.Top + 1, CB1.Items[Index]);
end;
end;
procedure TfrPrintForm.PropButtonClick(Sender: TObject);
begin
PrinterSetupDialog1.Execute;
CB1.ItemIndex := Printer.PrinterIndex;
end;
procedure TfrPrintForm.CB1Click(Sender: TObject);
begin
Prn.PrinterIndex := CB1.ItemIndex;
end;
procedure TfrPrintForm.E2Click(Sender: TObject);
begin
RB3.Checked := True;
end;
procedure TfrPrintForm.RB3Click(Sender: TObject);
begin
E2.SetFocus;
end;
end.
|