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

📄 setprint.pas

📁 三層源碼,DELPHI寫的三層源碼,三層源碼,
💻 PAS
字号:
unit setprint;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, QRPrntr,printers, ExtCtrls, xpButton;

type
  Tsetprints = class(TForm)
    ComboBox2: TComboBox;
    Bevel1: TBevel;
    PaperSize: TComboBox;
    Label5: TLabel;
    Bevel2: TBevel;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    Edit4: TEdit;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Edit5: TEdit;
    Edit6: TEdit;
    Label9: TLabel;
    xpButton1: TxpButton;
    procedure FormPaint(Sender: TObject);
    procedure PaperSizeChange(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure xpButton1Click(Sender: TObject);
  private
    procedure readinfor;
    procedure writeinfor;
    { Private declarations }
  public
    localstr:string;
    { Public declarations }
  end;

var
  setprints: Tsetprints;

implementation

uses sldata,shareunit;

{$R *.DFM}

procedure Tsetprints.FormPaint(Sender: TObject);
begin
sl_data.formonpaint(self);
end;

procedure Tsetprints.PaperSizeChange(Sender: TObject);
var s1,s2:string;
    PS : TQRPaperSize;
begin
for PS:= Default to Custom do
if QRPaperName(PS) = PaperSize.text then break;
if (ps<>default)and(ps<>Custom) then
 begin
 s1:=floattostr(round(cQRPaperSizeMetrics[PS, 0]));
 s2:=floattostr(round(cQRPaperSizeMetrics[PS, 1]));
 label9.caption:=' 页宽:'+s1+' 页高:'+s2+' (毫米)';
 edit5.ReadOnly:=true; edit5.Color:=clmenu;
 edit6.ReadOnly:=true; edit6.Color:=clmenu;
 edit5.text:=s1;edit6.text:=s2;
 end;
if ps=Custom then
 begin
 edit5.ReadOnly:=false; edit5.Color:=clwindow;
 edit6.ReadOnly:=false; edit6.Color:=clwindow;
 label9.caption:='自定义尺寸';
 end;
if ps=default then
 begin
 edit5.ReadOnly:=true; edit5.Color:=clmenu;
 edit6.ReadOnly:=true; edit6.Color:=clmenu;
 edit5.text:=s1;edit6.text:=s2;
 label9.caption:='默认尺寸';
 end;
end;

procedure tsetprints.readinfor;
var msg:string;
begin
with tstringlist.create do
  try
  add(makeparams('operid',inttostr(Query_sysother)));
  add(makeparams('funid',inttostr(public_list)));
  add(makeparams('tuid',localstr));
  msg:=text;
  finally
  free;
  end;
sl_data.querysinfo.Data:=sl_data.querysinfo.DataRequest(msg);
if sl_data.querysinfo.recordcount=1 then
   begin
   papersize.itemindex:=PaperSize.Items.IndexOf(sl_data.querysinfo['pagesize']);
   edit5.text:=sl_data.querysinfo['width'];
   edit6.text:=sl_data.querysinfo['height'];
   edit3.Text:=sl_data.querysinfo['pageleft'];
   edit4.text:=sl_data.querysinfo['pageright'];
   edit1.Text:=sl_data.querysinfo['pagetop'];
   edit2.text:=sl_data.querysinfo['pagebottom'];
   combobox2.itemindex:=sl_data.querysinfo['orientation'];
   end;
end;

procedure Tsetprints.writeinfor;
var msg:string;
begin
with tstringlist.create do
 try
 add(makeparams('tuid',localstr));
 add(makeparams('tpagesizes',papersize.Text));
 add(makeparams('tptop',edit1.text));
 add(makeparams('tpbottom',edit2.text));
 add(makeparams('tpright',edit4.text));
 add(makeparams('tpleft',edit3.text));
 add(makeparams('tcwidth',edit5.text));
 add(makeparams('tcheight',edit6.text));
 add(makeparams('torientation',inttostr(combobox2.ItemIndex)));
 msg:=text;
 finally
 free;
 end;
sl_data.sysother_model(public_add,msg);
end;

procedure Tsetprints.FormShow(Sender: TObject);
var
  PS : TQRPaperSize;
begin
  papersize.clear;
  for PS:=Default to Custom do
    PaperSize.Items.Add(QRPaperName(PS));
  papersize.itemindex:=PaperSize.Items.IndexOf('A4 210 x 297 mm');
  edit5.text:='210';
  edit6.text:='297';
  edit3.Text:='5';
  edit4.text:='5';
  edit1.Text:='5';
  edit2.text:='5';
  combobox2.itemindex:=0;
  readinfor;
end;

procedure Tsetprints.xpButton1Click(Sender: TObject);
begin
writeinfor;
close;
end;

end.

⌨️ 快捷键说明

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