How to use the barcode components with FastReport
  1. Edit your report, put a TfrxPictureView control to your report in order to present the barcode symbol.
  2. Put a TBarcode1D barcode component, such as the TBarcode1D_Code39, TBarcode1D_EAN13, and TBarcode1D_Code128 to your form that the TfrxReport component is in it.

    Also, put a TDBBarcode1D component to the form and link the TBarcode1D component to the TDBBarcode1D component if the database support is required.

  3. Create the OnBeforePrint event function for the TfrxReport component.

    In the event function, change the properties of the TBarcode1D component such as Barcode, Module, and Ratio, and adjust the bitmap size of the TfrxPictureView control in order to accommodate entire barcode symbol, then use the DrawTo method of the TBarcode1D component to draw the barcode symbol to the TfrxPictureView control.

    For example:


    BarcodeWidth, BarcodeHeight, SymbolWidth, SymbolHeight: Integer;



    Barcode1D_Code391.Barcode := '1235678';

    Barcode1D_Code391.Module := 2;


    with  TfrxPictureView(frxReport1.FindObject('Picture1')).Picture.Bitmap do


    Barcode1D_Code391.DrawToSize(BarcodeWidth, BarcodeHeight, SymbolWidth, SymbolHeight, Canvas);

    Width := BarcodeWidth;

    Height := 100;

    Barcode1D_Code391.DrawTo(Canvas, 0, 0);


    Note, if you use old FastReport 2.x, please use the OnBeginBand event.