在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
uses vcl.Graphics, DelphiZXingQRCode; procedure CreateQRCode(AImg: vcl.Graphics.TBitMap; const ACode: String); const IMG_SCALE = 25; //放大倍数 var QRCode: TDelphiZXingQRCode; Row, Column: Integer; begin if (AImg = nil) or (Trim(ACode) = '') then Exit; QRCode := TDelphiZXingQRCode.Create; try QRCode.Data := ACode; QRCode.Encoding := TQRCodeEncoding(qrUTF8BOM); QRCode.QuietZone := 1; QRCode.Data := ACode; AImg.Height := QRCode.Rows * IMG_SCALE; AImg.Width := QRCode.Columns * IMG_SCALE; AImg.Canvas.Lock; AImg.Canvas.Brush.Color := clWhite; AImg.Canvas.FillRect(Rect(0, 0, AImg.Width, AImg.Height)); AImg.Canvas.Brush.Color := clBlack; for Row := 0 to QRCode.Rows - 1 do for Column := 0 to QRCode.Columns - 1 do if QRCode.IsBlack[Row, Column] then begin AImg.Canvas.FillRect(Rect(Column * IMG_SCALE, Row * IMG_SCALE, Column * IMG_SCALE + IMG_SCALE, Row * IMG_SCALE + IMG_SCALE)); end; AImg.Canvas.Unlock; finally QRCode.Free; end; end;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论