#include "FiveWin.ch"
#define PAD_LEFT 0
static oWnd,oPrn,oPenDot,oPenFill,oPenSolid
//----------------------------------------------------------------------------//
function Main()
DEFINE WINDOW oWnd FROM 1, 1 TO 20, 60 TITLE "Printing a Window"
@ 3, 3 BUTTON "&Print me" OF oWnd SIZE 80, 20 ;
ACTION PrintMe() // try also with oWnd:HardCopy()
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function PrintMe()
PRINT oPrn NAME "Test" PREVIEW
oPrn:SetLandscape()
DEFINE BRUSH oPenFill COLOR CLR_HGRAY
Define Pen oPenDot style PS_DOT Width 1 Color CLR_BLACK Of oPrn
DEFINE FONT oFont07v NAME "ARIAL" SIZE 0,-07 OF oPrn NESCAPEMENT 900
Define Pen oPenSolid style PS_SOLID Width 2 Color CLR_BLACK Of oPrn
PAGE
Box(05.9,1.5,0.6,01.2,"","Faturas",PAD_LEFT,,,,,oFont07v,,.t.,.t.)
Box(07.1,1.5,0.6,01.2,""," Cálculo",PAD_LEFT,,,,,oFont07v,,.t.,.t.)
Box(07.1,1.7,0.6,01.2,""," Imposto",PAD_LEFT,,.f.,,,oFont07v,,.t.)
Box(08.3,1.5,0.6,01.9,"","Transportador",PAD_LEFT,,,,,oFont07v,,.t.,.t.)
ENDPAGE
ENDPRINT
return nil
FUNCTION Box(nlin,nCol,nComprimento,nAltura,uGroup,uTexto,nPadTexto,oLogoImage,lDrawBox,nTotalItens,lPosiciona,oFont,lFazQuebra,lVertical,lFill)
LOCAL aPos:=Array(2),aTam:=Array(2),nPos,nRow,f,nLinha,nLinhasTexto,nMarginTexto,aMargin,lPrimeiraVez,lFimPag:=.f.
LOCAL nMarginCol, nMarginTam,nMarginRow,nCont,cTexto,cParteTexto,aGroup,nStart
Default utexto:="", nPadTexto:=PAD_LEFT,lDrawbox:=.t.
Default lPosiciona:=.f.,lVertical:=.f.,lFill:=.f.
aPos[1]:=((nLin * 10 * (oPrn:nVertRes() / oPrn:nVertSize() )))
aPos[2]:=((nCol * 10 * (oPrn:nHorzRes() / oPrn:nHorzSize() )))
aTam[1]:=((nComprimento * 10 * oPrn:nVertRes() / oPrn:nVertSize()))
aTam[2]:=(nAltura * 10 * oPrn:nHorzRes() / oPrn:nHorzSize())
aGroup:=If(Valtype(uGroup)=="A",uGroup,{uGroup})
IF lPosiciona
aLinhaLista[nPagAtual]:={}
aPosicaoLista[nPagAtual]:={}
ENDIF
IF lDrawBox
oPrn:RoundBox(aPos[2],aPos[1],aPos[2]+aTam[1],aPos[1]+aTam[2],20,20,oPenSolid,If(lFill,CLR_HGRAY,NIL))
ENDIF
aPos[1]:=(((nLin+nAltura-0.2) * 10 * (oPrn:nVertRes() / oPrn:nVertSize() )))
aPos[2]:=((nCol * 10 * (oPrn:nHorzRes() / oPrn:nHorzSize() )))
aMargin := oPrn:SizeInch2Pix(If(Empty(aGroup[1]),0.03,0.08),0.03)
nRow := aPos[1]+aMargin[2]
nCol := aPos[2]+aMargin[1]
oPrn:Say(nRow,nCol,uTexto,oFont,,CLR_BLACK,,PAD_LEFT)
Return(Nil)