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

📄 htpz.pas

📁 会展条码票务管理、门禁、印刷、现场制证(摄像、登记、印刷)、总控中心、接待管理、展位管理
💻 PAS
字号:
unit htpz;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, xpPages, BusinessSkinForm, StdCtrls, xpCombo,
  bsSkinCtrls, bsSkinGrids, bsDBGrids, RzPanel, RzSplit, ExtCtrls, xpButton,
  bsdbctrls, bsSkinShellCtrls, RzTreeVw, RzShellCtrls, bsfilectrl,
  bsSkinBoxCtrls,jpeg,RzListVw,BarHL,Barcode,math,printers,
  DBCtrls, RzCmboBx;

type
  TzjForm = class(TForm)
    xpPageControl1: TxpPageControl;
    xpTabSheet1: TxpTabSheet;
    xpTabSheet2: TxpTabSheet;
    RzSplitter1: TRzSplitter;
    RzSplitter2: TRzSplitter;
    RzSizePanel1: TRzSizePanel;
    RzPanel1: TRzPanel;
    modelGrid: TbsSkinDBGrid;
    lxComboBox: TxpComboBox;
    xpButton1: TxpButton;
    xpButton2: TxpButton;
    xpButton3: TxpButton;
    RzShellList1: TRzShellList;
    Panel1: TPanel;
    Barcode1: TBarcode;
    bsSkinDBImage2: TDBImage;
    bsSkinDBImage1: TDBImage;
    bsBusinessSkinForm1: TbsBusinessSkinForm;
    procedure FormCreate(Sender: TObject);
    procedure xpButton1Click(Sender: TObject);
    procedure xpButton2Click(Sender: TObject);
    procedure lxComboBoxChange(Sender: TObject);
    procedure xpButton3Click(Sender: TObject);
    function ZoomInOut(m, n:  extended):tbitmap;
    procedure Barcode1Click(Sender: TObject);
  private
    { Private declarations }
     public
    { Public declarations }
  end;

var
  zjForm: TzjForm;
  Abitmap:tbitmap;

implementation

uses main, qtdj, Unit1;

{$R *.dfm}

function TzjForm.ZoomInOut(m, n:  extended):tbitmap;
var
  Mybmp: TBitmap;
begin
  self.DoubleBuffered := True;
  Mybmp := TBitmap.Create;
  Mybmp.Width := Trunc(m);//m * Self.bsskindbimage2.Width);
  Mybmp.Height := Trunc(n);//n * self.bsskindbimage2.Height);
  SetStretchBltMode(Mybmp.Canvas.Handle, HalfTone);
  Stretchblt(Mybmp.Canvas.Handle, 0, 0, Mybmp.Width,Mybmp.Height,abitmap.Canvas.Handle, 0, 0,abitmap.Width,abitmap.Height,SRCCOPY);
  Mybmp.PixelFormat := pf24bit;
  //MyBmp.Assign(newbmp);
  result:=MyBmp;
 // MyBmp.Free;
end;
 
procedure TzjForm.FormCreate(Sender: TObject);
begin
Abitmap:=tbitmap.Create;

lxcombobox.Clear;
lxcombobox.Text:='请选择要制证的类型';
mainform.typequery.first;
while not mainform.typeQuery.Eof do
begin
lxcombobox.Items.Add(mainform.typeQuerytype_id.Value+trim(mainform.typeQuerytype_name.Value)+':'+trim(mainform.typeQuerymodel.Value));
mainform.typeQuery.Next;
end;
end;

procedure TzjForm.xpButton1Click(Sender: TObject);
begin
if mainform.oPDialog.Execute then
begin
mainform.ry2.Edit;
bsskindbimage2.Picture.Bitmap.LoadFromFile(mainform.oPDialog.FileName);
end;
end;

procedure TzjForm.xpButton2Click(Sender: TObject);
begin
try
mainform.ry2.Post;
except
mainform.ry2.Edit;
mainform.ry2.Post;
end;
end;

procedure TzjForm.lxComboBoxChange(Sender: TObject);
begin
mainform.model2.Close;
mainform.model2.Parameters.ParamByName('m_id').Value:=copy(lxcombobox.Text,length(trim(lxcombobox.Text))-2,3);
mainform.model2.Open;
mainform.ry2.Close;
mainform.ry2.Parameters.ParamByName('l_lx').Value:=copy(lxcombobox.Text,1,3);
mainform.ry2.Open;
mainform.ty2.Close;
mainform.ty2.Parameters.ParamByName('t_id').Value:=copy(lxcombobox.Text,1,3);
mainform.ty2.Open;
end;

procedure TzjForm.xpButton3Click(Sender: TObject);
var
img1,img2:TImage;
  pdest,psour:hbitmap;
  LogFont: TLogFont;
  SaveFont: TFont;
  Point:TPoint;
  mybarcode:tbarcode;//a fly;

begin

    Img1 := TImage.Create(self);
    img1.Visible := True;
    Img1.Stretch := True;

    Img2 := TImage.Create(self);
    img2.Visible := True;
    Img2.Stretch := True;


    Mainform.ry2.First;

        while not mainform.ry2.Eof do
          begin

            Img1 := TImage.Create(self);
            img1.Visible := True;
            Img1.Stretch := True;

            Img2 := TImage.Create(self);
            img2.Visible := True;
            Img2.Stretch := True;



             Abitmap:=bsskindbimage2.Picture.Bitmap;
             img1.Picture.Bitmap:=zoominout(370,495);
             Abitmap:=bsskindbimage1.Picture.Bitmap;
             img2.Picture.Bitmap:=zoominout(1014,1416);

             psour:=img1.canvas.handle; {源图句柄}
             pdest:=img2.canvas.handle; {目的图句柄}
              //贴照片
             bitblt(pdest,mainform.model2ph_h.Value,mainform.model2ph_v.Value,img1.picture.width,img1.picture.Height,psour,0,0,srccopy);

            // IMG1.Free;
             Img1 := TImage.Create(self);
             img1.Visible := True;
             Img1.Stretch := True;

             BARCODE1.Bar_Caption:=trim(mainform.ry2guest_id.value);

 {    }
with img2.Canvas do begin

    img2.Canvas.Font.Size:=48;
    img2.Canvas.Font.Name:='幼圆';
    img2.Canvas.Font.Style:=[fsBold];
    img2.Canvas.Font.Color:=clwhite;
      SaveFont := TFont.Create;
      SaveFont.Assign(img2.Canvas.Font);
      GetObject(SaveFont.Handle, sizeof(TLogFont), @LogFont);
        with LogFont do
    begin
      lfEscapement := 0 *10;
      lfPitchAndFamily := FIXED_PITCH or FF_DONTCARE;
    end;
      img2.Canvas.Font.Handle := CreateFontIndirect(LogFont);
      SetBkMode(img2.Canvas.Handle, TRANSPARENT);
     //写名字
    img2.Canvas.TextOut(mainform.model2name_h.Value,mainform.model2name_v.Value,trim(mainform.ry2guest_name.Value));
     //写国籍
    img2.Canvas.TextOut(mainform.model2countyr_h.Value,mainform.model2country_v.Value,trim(mainform.ry2gj.Value));
    img2.Canvas.Font.Size:=24;
    img2.Canvas.Font.Name:='Arial';
    img2.Canvas.TextOut(mainform.model2countyr_h.Value-110,mainform.model2country_v.Value+80,trim(mainform.ry2cename.Value));

    SaveFont.Free;



//条码处理,不允许放大和缩小

  MyBarcode:=TBarcode.create(self); {Create TBarcode object!}
   With MyBarcode do {Set some default options}
    begin
    {Set a code as You like}
    Bar_Caption:=barcode1.Bar_Caption;
    {Set normal Height,
     this is default, but for demonstration purposes...}
    Bar_HeightPercent:=120;
    bar_fontscaling:=110;
    {No high density codes,
     this is default, but for demonstration purposes...}
    Bar_HighDensity:=false;
    {Set "Normal width" which is SC2,
     this is default, but for demonstration purposes...}
    Bar_Modulewidth:=SC9;
    {With Laserprinters always use Widthreduce:=false,
     this is default, but for demonstration purposes...}
    Bar_Widthreduce:=false;
    {While printing always use Bar_ZoomSize:=false,
     this is default, but for demonstration purposes...}
    Bar_ZoomSize:=false;
        bar_humanreadable:=true;
        bar_fontname:='Arial';
  end;

  {Find out printing offset on page}
 escape(Printer.handle,Getprintingoffset,0,nil,@point);
  {Adjust printing offset, so output starts at the
   same coordinates on all printers}
  SetViewPortOrgEx(Printer.handle,-point.x,point.y,nil);
  img2.Picture.Bitmap.Canvas.Font.Name:='Arial';
  img2.Canvas.Font.Size:=42;
  img2.Canvas.Font.Color:=clBLACK;
  MyBarcode.Bar_Codetype:=code128_b;
           img1.Free;
           img1:=timage.Create(self);
             img1.Picture.Bitmap.Height:=3*barcode1.Height;
             img1.Picture.Bitmap.Width:=2*barcode1.Width;
             MyBarcode.Print(img1.canvas,0,0,@Point);//75,375
           //  Barcode1.CopyToRect(img1.Canvas,Barcode1.BoundsRect);
             abitmap:=img1.Picture.Bitmap;
             img1.Picture.Bitmap:=zoominout(500,150);
           //  img1.Picture.Bitmap.PixelFormat := pf1bit;
             psour:=IMG1.canvas.handle; //BARCODE源图句柄
             //贴条码




 // MyBarcode.Print(img2.canvas, mainform.model2bh_h.Value,mainform.model2bh_v.Value,@Point);//75,375
bitblt(pdest,mainform.model2Bh_h.Value,mainform.model2Bh_v.Value,IMG1.picture.width,IMG1.picture.Height,psour,0,0,srccopy);
      //存盘
img2.Picture.SaveToFile('.\export\'+trim(mainform.ry2guest_id.Value)+'.bmp');

mybarcode.Free;

img1.Free;
img2.Free;
mainform.ry2.Next;
//end;
end; //bsskindbimage1.Picture.Assign(img2.Picture.Bitmap);
end;
end;


procedure TzjForm.Barcode1Click(Sender: TObject);
begin
BARCODE1.SaveToFile(100,'..\BAR.BMP');
end;

end.

⌨️ 快捷键说明

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