I'm trying to print a bar code on a quick report. I've downloaded TurboPower's SysTools, but can't get it working. When I run my project, the bar code appears on the form, but not in the printed version. I've tried pasting the bar code component onto the QR1band and also into QR1Shape1, but that does nothing.

 

I've tried using a procedure of TStBarCode, which is PaintToCanvas, to paint the bar code into QR1Shape1, but the shape rectangle prints with nothing inside - no bar code.

 

I've also tried "QRBand1.InsertControl(StBarCode1)", but that only caused an access violation. (Since TStBarCode descends from TControl, I thought this might have worked).

 

I'm sure this is simple, but I just don't know enough about components and OO stuff to get it working.

 

My code is below. Any ideas?

 

Cheers

Dave

 

 

 

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StBarC, ExtCtrls, Quickrep, StdCtrls;

 

type

  TForm1 = class(TForm)

    QReportOne1: TQReportOne;

    QR1Band1: TQR1Band;

    QR1Shape1: TQR1Shape;

    StBarCode1: TStBarCode;

    procedure FormActivate(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.dfm}

 

procedure TForm1.FormActivate(Sender: TObject);

begin

  StBarCode1.Code := '12345678';

  StBarCode1.PaintToCanvas(QR1Shape1.Canvas,QR1Shape1.BoundsRect);

  Form1.QReportOne1.Print;

end;

 

end.

 

 

Dave Jollie

Tower NZ IT

09 368 4259

 

Reply via email to