by vensanto » Tue Jul 16, 2013 6:57 pm
Ciao
questa è la funzione che utilizzo per stampare il QRCode
spero vi possa essere utile
===
#Include "FiveWin.ch"
* richiede la libreria HBZEBRA.LIB
* *********************************************************
* PROCEDURE MAIN
* PRINT oPRN PREVIEW
* PAGE
* EanQRCode(oPRN,50,50,1,"www.veneziasoft.com")
* ENDPAGE
* ENDPRINT
* RETURN
* *********************************************************
* iFlags = estratto da QRCODE.C della libreria HBZEBRA.LIB
*
* #define HB_ZEBRA_FLAG_QR_LEVEL_MASK 0x0700
* #define HB_ZEBRA_FLAG_QR_LEVEL_L 0x0100
* #define HB_ZEBRA_FLAG_QR_LEVEL_M 0x0200
* #define HB_ZEBRA_FLAG_QR_LEVEL_Q 0x0300
* #define HB_ZEBRA_FLAG_QR_LEVEL_H 0x0400
*
* switch( iFlags & HB_ZEBRA_FLAG_QR_LEVEL_MASK )
* {
* case HB_ZEBRA_FLAG_QR_LEVEL_M:
* iLevel = 1;
* break;
* case HB_ZEBRA_FLAG_QR_LEVEL_Q:
* iLevel = 2;
* break;
* case HB_ZEBRA_FLAG_QR_LEVEL_H:
* iLevel = 3;
* break;
* default:
* iLevel = 0;
* break;
*
* *********************************************************
* EanQRCode(oPRN, nY, nX, nWidth, nQRCODE, nColor, iFlags)
*
* oPRN = Output Device
* nY = Rigo di inizio stampa
* nX = Colonna di inizio stampa
* nWidth = Spessore del QRCODE - default = 1
* nQRCODE = Stringa del QRCODE
* nColor = Colore del QRCODE - default = CLR_BLACK
* iFlags = Flags
*
* *********************************************************
******************************************************************
Function EanQRCode(oPRN, nY, nX, nWidth, nQRCODE, nColor, iFlags)
Local hCODE,oBRUSH,nRET
Local nCLR:=IIF(nColor<>NIL,nColor,CLR_BLACK)
Local nLineWidth:=IIF(nWidth==NIL .OR. nWidth<1,1,nWidth)
Local nLineHeight:=nLineWidth
Local nSCALE:=7.2
hCODE:=hb_zebra_create_qrcode(nQRCODE,iFlags)
nY *= nSCALE
nLineWidth *= nSCALE
IF hCODE != NIL
IF hb_zebra_geterror( hCODE ) == 0
IF Empty( nLineHeight )
nLineHeight := 16
ENDIF
IF hb_zebra_geterror( hCODE ) != 0
RETURN HB_ZEBRA_ERROR_INVALIDZEBRA
Endif
DEFINE BRUSH oBRUSH COLOR nCLR
nRET:=hb_zebra_draw( hCODE, {|x,y,w,h| oPRN:FillRect({Int(y+.5), Int(x+.5), Int(y+.5)+Int(h)+1, Int(x+.5)+Int(w)},oBRUSH) }, nX*nSCALE, nY, nLineWidth, nLineHeight*nSCALE )
oBRUSH:End()
Endif
hb_zebra_destroy( hCODE )
Endif
Return nRET
===
Saluti
Santo Venezia