Code: Select all | Expand
// \samples\SHADOW.PRG - 20/10/2020 - kapiabafwh@gmail.com
#include "fivewin.ch"
#define PAD_LEFT 0
#define PAD_RIGHT 1
#define PAD_CENTER 2
FUNCTION Imp_Silvio()
LOCAL oPrn, oFont, oFont2, oFont3, oPen, oPen1, oPen2, oPen3, cFiveWin
LOCAL nLinI, nColI, nLinF, nColF, oBrush
LOCAL ResLinha, ResColuna, nLinha, nColuna
LOCAL nLinTopBox, nColTopBox, nLinBotBox, nColBotBox
LOCAL ShadowIni, ShadowFin
PRINT oPrn NAME "TEST SILVIO BOX SHADOW..." PREVIEW
DEFINE BRUSH oBrush COLOR nRGB( 215, 215, 215 )
DEFINE FONT oFont NAME "Arial" SIZE 0, - 6 BOLD OF oPrn
DEFINE FONT oFont2 NAME "Arial" SIZE 0, - 12 BOLD Underline OF oPrn
DEFINE FONT oFont3 NAME "Arial" SIZE 0, - 18 BOLD OF oPrn
DEFINE PEN oPen WIDTH 1 COLOR CLR_BLACK OF oPrn
Define Pen oPen1 Width 50 COLOR nRgb( 192, 192, 192 )
DEFINE PEN oPen2 WIDTH 2 COLOR CLR_BLACK OF oPrn
// aqui Silvio:
DEFINE PEN oPen3 WIDTH 410 COLOR nRgb( 192, 192, 192 ) OF oPrn
oPrn:SetPage( 9 ) // A4
oPrn:SetPortrait() //Vertical
ResLinha := oPrn:nLogPixely() / 2.54
ResColuna := oPrn:nLogPixelx() / 2.54
PAGE
nLinha := 1.00
nColuna := 5.5
nLinTopBox := 1.50 //-> Linha Que o Box Inicia Topo
nColTopBox := 14.00 //-> Largura do Box
nLinBotBox := 2.50 //-> Tamanho do Box de Cima Para Baixo
nColBotBox := 8.00 //-> Coluna Que o Box Inicia
oPrn:Cmtr2Pix( @nLinTopBox, @nColTopBox )
oPrn:cmtr2Pix( @nLinBotBox, @nColBotBox )
/* // otro modo
ShadowIni := oPrn:Cmtr2Pix( nLinTopBox, 6.5 )
ShadowFin := oPrn:cmtr2Pix( nLinBotBox, 14.5 )
*/
// Shadow Box
oPrn:Box( nLinTopBox, nColTopBox, nLinBotBox, nColBotBox, oPen3 )
// oPrn:FillRect( { ShadowIni[1], ShadowIni[2], ShadowFin[1], ShadowFin[2] }, oBrush )
nColuna := nColuna += 2.10
// oPrn:cmSay( 1, 5.5, "Tipo documento", oFont, 4.5, CLR_BLACK, , PAD_LEFT )
oPrn:Say( nLinha * ResLinha, nColuna * ResColuna, ;
+ "Tipo documento:", oFont,, CLR_BLACK,, PAD_LEFT )
nLinha := nLinha += 0.50
nColuna := 10.5
//oPrn:cmSay( 1, 5.5, "DESCRIZIONE DOCUMENTO", oFont2, 4.5, CLR_BLACK, , PAD_CENTER )
oPrn:Say( nLinha * ResLinha, nColuna * ResColuna, ;
+ "DESCRIZIONE DOCUMENTO", oFont2,, CLR_BLACK,, PAD_CENTER )
nLinha := nLinha += 0.80
oPrn:Say( nLinha * ResLinha, nColuna * ResColuna, ;
+ "Silvio Falconi Corporation And FiveWin", oFont,, CLR_BLACK,, PAD_LEFT )
ENDPAGE
ENDPRINT
oPen:End()
oPen1:End()
oPen2:End()
oPen3:End()
oFont:End()
oFont2:End()
oFont3:End()
RETURN NIL
//-> http://forums.fivetechsupport.com/viewtopic.php?f=3&t=39498
/*
Silvio.Falconi escribió:
METHOD Box( nTop, nLeft, nBottom, nRight, ;
[Pen], ; // oPen/hPen/nColor/{nColor,nThickness}
[Brush], ; // nColor / oBrush
[aText], ; // { cText, oFont, nColor } Painted in center
cUnits ; // "CM", "MM", "INCHES"
)
I tried to use aText array but I can set only { cText, oFont, nColor } and it was printed in center
How I can to print it with align ?
Now, aText can be { cText, oFont, nTxtColor, cAlign }
cAlign:
"TL" : TopLeft
"TR" : TopRight
"T" : Top Center
"BL" : Bottom Left
"BR" : Bottom Right
"B" : Bottom Center
"L" : Left Vert Center
"R" : Right Vert Center
But you can use this for only String, though this string can be multi-line delimited by CRLF.
If you want to print 2 or more strings with different alignments, you need to write your own code for that
*/
function PrnBox()
local oPrn, oFont, oBrush
DEFINE BRUSH oBrush FILE "c:\fwh\bitmaps\backgrnd\pebbles.bmp"
PRINT oPrn PREVIEW
DEFINE FONT oFont NAME "VERDANA" SIZE 0,-30 OF oPrn BOLD
PAGE
oPrn:RoundBox( 1, 1, 5, 5, .5, .5, { CLR_HRED, 3 }, oBrush, ;
{ "FIRST" + CRLF + "SECOND", oFont, CLR_WHITE, "B" }, ;
"INCHES" )
@ 1,1 PRINT TO oPrn TEXT "HOLLOW TEXT" SIZE 4, 4 INCHES FONT oFont ;
COLOR CLR_YELLOW OUTLINE CLR_HRED SIZE 3 ALIGN "T"
ENDPAGE
ENDPRINT
RELEASE FONT oFont
RELEASE BRUSH oBrush
return nil
Regards, saludos.