Pdf417, limpiar dibujo anterior

Pdf417, limpiar dibujo anterior

Postby J. Ernesto » Fri Oct 01, 2021 7: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: Select all  Expand view

# 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.
Fivewin 1905 + BCC++ 700 + Harbour 3.20 + LopeEdit 5.8 + UEstudio 26.0
jepsys@hotmail.com, jepsys@gmail.com, jepsys@yahoo.com
User avatar
J. Ernesto
 
Posts: 152
Joined: Tue Feb 03, 2009 10:08 pm
Location: Bogotá D.C. Colombia

Re: Pdf417, limpiar dibujo anterior

Postby karinha » Fri Oct 01, 2021 11:44 am

Code: Select all  Expand view

// \SAMPLES\ERNESTO.PRG  - kapiabafwh@gmail.com - 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
User avatar
karinha
 
Posts: 7244
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 8 guests