📄 main.pas
字号:
{*******************************************************}
{ }
{ This unit is part of the VISPDF VCL library. }
{ Written by R.Husske - ALL RIGHTS RESERVED. }
{ }
{ Copyright (C) 2000-2008, www.vispdf.com }
{ }
{ e-mail: support@vispdf.com }
{ http://www.vispdf.com }
{ }
{*******************************************************}
unit Main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, VPDFDoc, ExtCtrls, Spin;
type
TForm1 = class(TForm)
Label1: TLabel;
FileNameEdit: TEdit;
CreateButton: TButton;
BarcodeTypeComboBox: TComboBox;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
WidthEdit: TSpinEdit;
BarValueEdit: TEdit;
Label6: TLabel;
Checksum: TCheckBox;
ColorDialog: TColorDialog;
Button2: TButton;
VPDF: TVPDF;
Button3: TButton;
BGPanel: TPanel;
ColorPanel: TPanel;
procedure CreateButtonClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.CreateButtonClick(Sender: TObject);
begin
VPDF.AutoLaunch := true; // PDF file will be shown automatically
VPDF.Compression := cmNone;
VPDF.FileName := FileNameEdit.Text; // Set PDF filename
VPDF.BeginDoc; // Create PDF file
VPDF.CurrentPage.DrawBarcode( TVPDFBarcodeType(BarcodeTypeComboBox.ItemIndex), // Draw colored barcode
10, 10, 50, WidthEdit.Value, 0, BarValueEdit.Text, // on the coordinates 10, 10
Checksum.Checked, ColorPanel.Color, BGPanel.Color );
VPDF.EndDoc; // Close PDF file
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if ColorDialog.Execute then
BGPanel.Color := ColorDialog.Color;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if ColorDialog.Execute then
ColorPanel.Color := ColorDialog.Color;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
BarcodeTypeComboBox.ItemIndex := 16;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -