There is an issue with displaying QR codes in Delphi7 Report Machine 5.5.

To display QR codes using Report Machine 5.5 in Delphi 7, follow these steps:

  1. Make sure you have already installed Delphi 7 and Report Machine 5.5.
  2. Create a new report project in Delphi 7 and add a TQRImage control to display a QR code at the desired location.
  3. Add the following code in the OnPrint event of the TQRImage control.
procedure TForm1.QRImage1Print(sender: TObject; var Value: string);
var
  QRCode: TDelphiZXingQRCode;
  QRBitmap: TBitmap;
begin
  QRCode := TDelphiZXingQRCode.Create;
  try
    QRCode.Data := 'Hello, World!'; // 设置二维码的数据
    QRCode.Encoding := TQRCodeEncoding.qrAuto; // 设置二维码的编码方式,可根据需要修改
    QRBitmap := QRCode.GetBitmap;
    try
      QRImage1.Picture.Assign(QRBitmap);
    finally
      QRBitmap.Free;
    end;
  finally
    QRCode.Free;
  end;
end;
  1. When running the program, the TQRImage control in the report will display a QR code containing the data “Hello, World!”.

Please note that the above code uses the third-party library DelphiZXing to generate QR codes. You can download and install this library from the DelphiZXing GitHub page (https://github.com/spksoft/DelphiZXingQRCode). Once installed, you will need to add the DelphiZXingQRCode unit to your reporting project.

In addition, you can modify the QR code data and encoding method in the code as needed.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds