-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit1.pas
82 lines (64 loc) · 1.66 KB
/
Unit1.pas
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
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
Spin, ComCtrls, ACBrPIXCD;
type
{ TForm1 }
TForm1 = class(TForm)
ACBrPixCD1: TACBrPixCD;
btSalvarPNG: TButton;
btSalvarPNG1: TButton;
btGerarQRCodePIX: TButton;
btGerarQRCodeTexto: TButton;
edChave: TEdit;
edInfo: TEdit;
edTexto: TEdit;
edCidade: TEdit;
edNome: TEdit;
edValor: TFloatSpinEdit;
imgQRCode: TImage;
Label1: TLabel;
Label2: TLabel;
lbInfo: TLabel;
lbTexto: TLabel;
lbCidade: TLabel;
lbNome: TLabel;
PageControl1: TPageControl;
Panel1: TPanel;
pnPIX: TPanel;
pnTexto: TPanel;
tsTexto: TTabSheet;
tsPIX: TTabSheet;
procedure btGerarQRCodePIXClick(Sender: TObject);
procedure btSalvarPNGClick(Sender: TObject);
procedure btGerarQRCodeTextoClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
uses
ACBrImage, ACBrDelphiZXingQRCode, ACBrUtil.Strings;
{$R *.lfm}
{ TForm1 }
procedure TForm1.btGerarQRCodePIXClick(Sender: TObject);
var
wQRCode: String;
begin
ACBrPixCD1.Recebedor.Nome := Trim(edNome.Text);
ACBrPixCD1.Recebedor.Cidade := Trim(edCidade.Text);
wQRCode := ACBrPixCD1.GerarQRCodeEstatico(edChave.Text, edValor.Value, edInfo.Text);
PintarQRCode(wQRCode, imgQRCode.Picture.Bitmap, qrUTF8BOM);
end;
procedure TForm1.btSalvarPNGClick(Sender: TObject);
begin
imgQRCode.Picture.SaveToFile('_QRCode_' + OnlyAlphaNum(edNome.Text) + '.png');
end;
procedure TForm1.btGerarQRCodeTextoClick(Sender: TObject);
begin
PintarQRCode(edTexto.Text, imgQRCode.Picture.Bitmap, qrUTF8BOM);
end;
end.