endeesfritpt

Delphi
Barcodes in projects

EnterpriseInfoPara usar esta funcionalidade você precisa de uma licença de desenvolvedor

Delphi

How to use barcodes in Delphi

1

You can use ActiveBarcode in Delphi like any other control (e.g. like a button). First you have to add the ActiveBarcode control into the Delphi development environment.

1. Add ActiveBarcode to the Delphi development environment


First import the ActiveBarcode Control into a package. Launch the function "Import Component" from the menu "Component".

Barcode, Delphi

2

The "Component dialog" appears:

Barcode, Delphi

3

Select "Import ActiveX control" and click "Next". Now a list of the available controls will be shown:

Barcode, Delphi

4

Select "ActiveBarcode" from that list and click "Next". A page for component setup will be shown:

Barcode, Delphi

5

You don't need to change something here. Click "Next". A page for "Create Unit" appears.

Barcode, Delphi

6

Select "Install to new package" here and click on "Next". The "New Package" dialog is showing up:

Barcode, Delphi

7

Enter a name for the new package, e.g. ActiveBarcode. Then click "Finish". Now ActiveBarcode is added as a component to the new package. Now you must compile the package. Select the function "Build ActiveBarcode" from the menu "Project":

Barcode, Delphi

8



2. An example of how to use ActiveBarcode now:

Create a new project: "File" - "New" - "VCL Forms Application":

Barcode, Delphi

9

To place ActiveBarcode on a form you select the ActiveBarcode Control from the tool palette. You'll find this under "ActiveX" as a "TBarcode" component:

Barcode, Delphi

10

Select TBarcode and place the component on the form. Sadly, Delphi adds the barcode object with a black background color.

Barcode, Delphi

11

But, no problem, simply fix this. In the object inspector you can customize the properties of the component. So set the background color to white.

Barcode, Delphi

12

Voila, the barcode object looks fine now:

Barcode, Delphi

13

In this example we add one more control, a TEdit to the form. Now your form might look as follows:

Barcode, Delphi

14

Next we link the edit field directly to the control. Open the source code for the "textchange" event by double clicking the edit field. This event always is called, if the contents of the edit field are changed. Ideally for our example. We give this update immediately to the control.

Barcode, Delphi

15

That's it. Now launch the program:

Barcode, Delphi

16

Change the content of the edit field to change the barcode.

Programming:
Setting properties is very simple. Some examples:

Barcode1.Text := '123456789012';
Barcode1.BackColor := clWhite;
Barcode1.ForeColor := clBlack;
Using the Picture Property:
Copy the barcode to a image object:
Image1.Picture.Bitmap.Height := Barcode1.Height;
Image1.Picture.Bitmap.Width := Barcode1.Width;
Barcode1.Picture.CleanupInstance;
Image1.Picture.Bitmap.Canvas.Draw(0,0,Barcode1.Picture.graphic);
Clipboard:
Copy the current barcode to the clipboard. Metafile (WMF):
  Barcode1.CopyToClipboard;
Bitmap:
Image1.Picture.Bitmap.Height := Barcode1.Height;
Image1.Picture.Bitmap.Width := Barcode1.Width;
Barcode1.Picture.CleanupInstance;
Image1.Picture.Bitmap.Canvas.Draw(0,0,Barcode1.Picture.graphic);
Clipboard.Assign(Image1.Picture.Bitmap);


| Página inicial | Comprar | Baixar | Email | Política de privacidade | Impressão | Version 6.8.0
Copyright © Frank Horn & Lars Schenk
Todas as marcas registradas e nomes de produtos mencionados são de propriedade de seus respectivos proprietários.



Com a versão em Português do nosso site queremos facilitar-lhe o conhecimento do ActiveBarcode. No entanto, o nosso extenso website ainda não foi totalmente traduzido. Portanto, alguns conteúdos estão actualmente disponíveis apenas em inglês e não assumimos qualquer responsabilidade pela exactidão das traduções. Obrigado pela sua compreensão e paciência. Como referência confiável e completa, recomendamos o site em inglês ou alemão.
Utilizamos cookies para lhe proporcionar a melhor experiência e funcionalidade no nosso website. Ao utilizar o nosso site você concorda com isso. Leia mais >