Also, put a TDBBarcode1D component to the form and link the TBarcode1D component to the TDBBarcode1D component if the database support is required.
For example:
RvProject1.Open;
RvProject1.Execute;
RvProject1.Close;
In the event function, change the properties of the TBarcode1D component such as Barcode, Module, and Ratio. Then create a temporary TBitmap object, adjust its size in order to accommodate entire barcode symbol, and use the DrawTo method of the TBarcode1D component to draw the barcode symbol to the temporary TBitmap object. At last, adjust the size of the bitmap component in your report, and assign the temporary bitmap to it.
For example:
var
RvReport: TRaveReport;
RvPage : TRavePage;
RvBitmap: TRaveBitmap;
TmpBitmap: TBitmap;
BarcodeWidth, BarcodeHeight, SymbolWidth, SymbolHeight: Integer;
Scale: Integer;
begin
......
Barcode1D_Code391.Barcode := '1235678';
Barcode1D_Code391.Module := 2;
......
with RvProject1.ProjMan do
begin
RvReport := FindRaveComponent('Report1', nil) as TRaveReport;
RvPage := FindRaveComponent('Page1', RvReport) as TRavePage;
RvBitmap := FindRaveComponent('Bitmap1', RvPage) as TRaveBitmap;
end;
TmpBitmap := TBitmap.Create;
try
Barcode1D_Code391.DrawToSize(BarcodeWidth, BarcodeHeight, SymbolWidth, SymbolHeight, TmpBitmap.Canvas);
TmpBitmap.Width := BarcodeWidth;
TmpBitmap.Height := BarcodeHeight;
Scale := 72;
RvBitmap.Width := RvReport.XI2U(BarcodeWidth / Scale);
RvBitmap.Height := RvReport.YI2U(BarcodeHeight / Scale);
RvBitmap.MatchSide := msBoth;
Barcode1D_Code391.DrawTo(TmpBitmap.Canvas, 0, 0);
RvBitmap.Image.Assign(TmpBitmap);
finally
TmpBitmap.Free;
end;
......
end;