Delphi 2005- - Barcodes in projects

EnterpriseTo use this functionality you require the Enterprise Edition

Info This example is for Delphi Version 2005 or better
There is also a description available for older Delphi versions (4-7).

How to use barcodes in Delphi

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.

Add ActiveBarcode to the Delphi development environment
(The is also a description for older Delphi versions (4-7) available)

Select a package in which you would like to take up the Control or create a new package ("File" - "New" - "Package Delphi for Win32 "):

Screenshot

Save this package under an own name with the "Save as" function. For example as "ActiveBarcodePackage".

Now import the ActiveBarcode Control in the package. Launch the function "Component import" from the menu "Component".

Screenshot

The "Component dialog" appears:

Screenshot

Select "ActiveX control" and click "Continue". Now a list of the available contols will be shown:

Screenshot

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

Screenshot

You don't need to change something here. Click "Continue". A page for "Install" appears.

Screenshot

Select "Add unit to the project .." here and click on "Finish". Now ActiveBarcode is added as a component to the package. Now you must compile the package. Select the function " ActiveBarcodePackage create" from the menu "Project":

Screenshot



Use ActiveBarcode (Example)

Create a new project: "File" - "New" - "Form application VCL". To place ActiveBarcode now onto a form you select the ActiveBarcode Control from the tool palette. You'll find this under "ActiveX" as a "TBarcode" component:

Screenshot

Select TBarcode and place the component on the form. In the object inspector you can customize the properties of the component. E.g. set the background color on white.

Screenshot

For this example add one more TEdit to the form. Now you form might look as follows:

Screenshot

Now we "link" the edit field directly with 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.

Screenshot

That's it. Now launch the program:

Screenshot

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.PictureAdapter := nil; // delphi workaround
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.PictureAdapter := nil; // delphi workaround
Image1.Picture.Bitmap.Canvas.Draw(0,0,Barcode1.Picture.graphic);
Clipboard.Assign(Image1.Picture.Bitmap);



Read more descriptions of how to add barcodes to standard applications (e.g. Office, Excel, Word, Access forms, Access reports, PowerPoint, OpenOffice.org, Lotus Notes, Publisher, Freelance, Freehand MX, Image Editors, WordPad, etc.)

rss twitter Bookmark and Share
| Home | Shop | Email | Datenschutz | Sitemap | Print preview | Version 5.58 | © Lars Schenk & Frank Horn

All trademarks and product names mentioned are the property of their respective owners.