How to add a barcode to a Visual C# or C++ project
You can use ActiveBarcode in Visual C# and C++ like any other control (e.g. like a button).
First you have to add the ActiveBarcode control into the development
1. Adding ActiveBarcode to the development environment
In this example, Visual C# is used. The procedure in Visual C++ is nearly identical.
Go to the menu "Tools" and select the function
"Choose Toolbox items":
A dialog appears. As ActiveBarcode is a COM component first select the tab
A list of the available controls will be displayed. Select
"ActiveBarcode" and activate it. Then click OK.
Now ActiveBarcode is added to your development environment.
2. Use ActiveBarcode in your project
Create a new project. Be aware that you select a project type that supports ActiveX controls:
To add the ActiveBarcode Control to a form you select the function "Toolbox" from
the "View" menu first. This opens the toolbox.
Have a look for the ActiveBarcode Control in the toolbox now.
Click on ActiveBarcode there and place it into the form.
The control will then be integrated on this form.
You can change the barcode properties of the barcode control now or later.
In this example we change the background color to white:
Now add a "Textbox" to this form, too.
Double click this textbox now to open the source code for the event "Textchange". We will use this event
to change the barcodes content every time the textbox changes.
That's it. Now launch this example application:
If you change the content of the textbox in the running application, the barcode will encode
Not visual usage of ActiveBarcode:
You also can create ActiveBarcode at run time and use the the control:
In the following example ActiveBarcode is created invisible, then a EAN-13 code with the encoded content "123456789012"
is generated and saved as image file by using the SaveAsBySize function.
BARCODELib.Barcode ab = new BARCODELib.Barcode();
ab.Text = "123456789012";
ab.TypeName = "EAN 13";
ab.SaveAsBySize("example.bmp", 400, 150);
If you have no reference to ActiveBarcode in your application, go to the Solution Explorer
and click with the right mouse button on "References", then select "Add Reference -> COM -> ActiveBarcode".
// Copy the barcode into the clipboard.
// Display the about box.
This manual was created by Frank Horn