FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Pdf417, limpiar dibujo anterior
Posts: 162
Joined: Tue Feb 03, 2009 10:08 PM
Pdf417, limpiar dibujo anterior
Posted: Fri Oct 01, 2021 07:23 AM
Buenas noches,

Una ayuda por favor.

Ell primer dibujo del c贸digo pdf417, se hace bien, cuando necesito generar el siguiente c贸digo, lo sobrescribe encima del anterior.

驴Qu茅 me hace falta?

Code (fw): Select all Collapse
# include "fivewin.ch"

Static oWnd, oImg_pdf417

Function MAIN ()
Local nAncho_CW := 002, onAncho_CW ,;
      nAlto_CW  := 004, onAlto_CW  ,; 
      nYi       := 410             ,; 
      nXi       := 020             ,; 
      nxAncho   := 600             ,; 
      nyAlto    := 250             ,; 
      sTipo_CB  := "PDF417"

Local oFont_WD_16
Local sFile  := cGetFile32 ( "Buscar textos para pdf417 *.txt | *.txt |", "Buscar otro archivo txt con los textos para el c贸digo pdf417", 0, hb_CurDrive () + ":\" + CurDir(), .F., , )
Local sTexto := MEMOREAD ( IIF ( LEN ( ALLTRIM ( sFile ) ) = 0, ".\z_qrcode.txt", sFile ) )

DEFINE FONT oFont_WD_16  NAME "TIMES NEW ROMAN" SIZE 0, -16

DEFINE ICON oIco FILENAME ".\zz_qrcode.ico"

DEFINE WINDOW oWnd FROM 000, 000 TO 660, 650 PIXEL ICON oIco ;                                         && Alto * Ancho
       TITLE "hb_zebra_create_pdf417"
   
 @ 167, 445 BUTTON oBtn_Otro PROMPT "Leer otro archivo *.txt" SIZE 186, 30 PIXEL FONT oFont_WD_16 OF oWnd ;
   MESSAGE "Buscar y leer otras l铆neas de texto" ;
   ACTION ( sFile  := cGetFile32 ( "Buscar textos para pdf417 *.txt | *.txt |", "Buscar otro archivo txt con los textos para el c贸digo pdf417", 0, hb_CurDrive () + ":\" + CurDir(), .F., , ) ,; && .F. = Abrir ) ,;
            sTexto := MEMOREAD ( IIF ( LEN ( ALLTRIM ( sFile ) ) = 0, ".\z_qrcode.txt", sFile ) ) ,;
            sFile_PDF417 := Dibujar_PDF417 ( oWnd:GetDC(), sTexto, nYi, nXi, nAncho_CW, nAlto_CW, CLR_BLUE ) )
 
 oBtn_Otro:cTooltip := { "Leer 0tro archivo para generar nuevo c贸digo pdf417", "Siguiente archivo *.txt", 1, CLR_WHITE, CLR_HRED }  

ACTIVATE WINDOW oWnd ;
 ON PAINT ( Dibujar_pdf417 ( hDC, sTexto, nYi, nXi, nAncho_CW, nAlto_CW ) )

Return ( NIL )
* -------------------------------------------------------------------------------------------------------------- *

* -------------------------------------------------------------------------------------------------------------- *
Function  Dibujar_pdf417 ( hDC, sTexto, nYi, nXi, nAncho_CW, nAlto_CW, nColor )
Local hZebra
Local hBrush := CreateSolidBrush ( 0 )

*? hdc

hZebra := HB_ZEBRA_CREATE_PDF417 ( sTexto, NIL )

oImg_pdf417 := HB_ZEBRA_DRAW ( hZebra , { | x, y, w, h | FILLRECT ( hDC   , { y, x, y + h, x + w }, hBrush ) }, nXi, nYi,     nAncho_CW,      nAlto_CW )
   
deleteobject     ( hBrush )
hb_zebra_destroy ( hZebra )
   
Return ( oImg_pdf417 )
* -------------------------------------------------------------------------------------------------------------- *


Muchas gracias por una ayuda.

J. Ernesto Pinto Q.
Fwh_x64 2501, BCC++_x64 7_70 , Harbour 3.20, LopeEdit 5.8
jepsys@hotmail.com, jepsys@gmail.com

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Pdf417, limpiar dibujo anterior
Posted: Fri Oct 01, 2021 11:44 AM
Code (fw): Select all Collapse
// \SAMPLES\ERNESTO.PRG  - <!-- e --><a href="mailto:kapiabafwh@gmail.com">kapiabafwh@gmail.com</a><!-- e --> - 01/10/2021

#Include "Fivewin.ch"

STATIC oWnd, oImg_pdf417, lDonde := .F.

FUNCTION Main()

   LOCAL nAncho_CW := 002, onAncho_CW, nAlto_CW := 004, onAlto_CW, ;
         nYi := 410, nXi := 020, nxAncho := 600, nyAlto := 250,    ;
         sTipo_CB := "PDF417"
   LOCAL oIco, oFont_WD_16, sFile, sTexto, sFile_PDF417, oBtn_Otro, cTitle
   LOCAL oBar

   cTitle := "hb_zebra_create_pdf417"

   sFile  := cGetFile32 ( "Buscar textos para pdf417 *.txt | *.txt |", "Buscar otro archivo txt con los textos para el c贸digo pdf417", 0, hb_CurDrive () + ":\" + CurDir(), .F., , )

   IF .NOT. EMPTY( sFile )

      sTexto := MEMOREAD ( IIF ( LEN ( ALLTRIM ( sFile ) ) = 0, ".\qrcode.txt", sFile ) )

   ELSE

      ? "Informe un archivo valido porfa..."

      RETURN NIL

   ENDIF

   DEFINE FONT oFont_WD_16  NAME "Times New Roman" SIZE 0, - 16

   // DEFINE ICON oIco FILENAME ".\zz_qrcode.ico"
   DEFINE ICON oIco FILE "..\icons\fax.ico"

   DEFINE WINDOW oWnd FROM 000, 000 TO 660, 650 PIXEL ICON oIco TITLE cTitle

   DEFINE BUTTONBAR oBar _3D SIZE 30, 30 OF oWnd

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\new.bmp" FLAT            ;
      ACTION MsgInfo( "New" ) ;
      TOOLTIP "Creates a new document"

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\open.bmp" FLAT           ;
      ACTION ( sFile  := cGetFile32( "Buscar textos para pdf417 *.txt | *.txt |", "Buscar otro archivo txt con los textos para el c贸digo pdf417", 0, hb_CurDrive () + ":\" + CurDir(), .F., , ), ;
      sTexto := MEMOREAD ( IIF ( LEN ( ALLTRIM ( sFile ) ) = 0, ".\qrcode.txt", sFile ) ), ;
      sFile_PDF417 := Dibujar_PDF417( oWnd:GetDC(), sTexto, nYi, nXi, nAncho_CW, nAlto_CW, CLR_BLUE, lDonde := .T. ) )

   ACTIVATE WINDOW oWnd ;
      ON PAINT ( Dibujar_pdf417( hDC, sTexto, nYi, nXi, nAncho_CW, nAlto_CW ) )

   oFont_WD_16:End()

RETURN NIL

FUNCTION  Dibujar_pdf417 ( hDC, sTexto, nYi, nXi, nAncho_CW, nAlto_CW, nColor )

   LOCAL hZebra, hBrush

   IF lDonde  // .T.

      ? "limpia window? Yes, sir!"

      lDonde := .F.

      oWnd:Refresh()

   ENDIF

   hBrush := CreateSolidBrush ( 0 )

   hZebra := HB_ZEBRA_CREATE_PDF417 ( sTexto, NIL )

   oImg_pdf417 := HB_ZEBRA_DRAW ( hZebra, {| x, y, w, h | FILLRECT ( hDC, { y, x, y + h, x + w }, hBrush ) }, nXi, nYi,     nAncho_CW,      nAlto_CW )

   deleteobject( hBrush )

   hb_zebra_destroy ( hZebra )

RETURN( oImg_pdf417 )

// fin / end


Regards, saludos.
Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion