#include "FiveWin.ch"
#define _MARGIN_LEFT 0.8 // the circle pattern starts 25 mm from Top
#define _MARGIN_TOP 2.7 // the circle pattern starts 2 mm from Left
#define _XSPACE 0.7 // distance horizontal between 2 circles
#define _YSPACE 0.7 // distance vertical between 2 circles
#define _CIRCLE 0.5 // each circle has 5 mm in diameter
FUNCTION Main()
//-------------
LOCAL n, o
LOCAL oPrn, oPen, oBrush
LOCAL nTop, nLeft, nBottom, nRight, aRect
LOCAL nVar := 1 // as lotto number
LOCAL nRow := 0 // row to find
LOCAL nCol := 0 // col to find
LOCAL aSelect := {}
LOCAL aNumbers:= {} //as DEMO silvio
LOCAL aRoutes:= {} //as DEMO silvio
// for selecting a number
/* for n := 1 to 90
aadd( aSelect, str( n, 2, 0 ) )
next
* nVar := MsgSelect( aSelect, " 1" )*/
//---------------------------------------------
aNumbers:= {30,54,17,18,81} //as DEMO silvio
aRoutes:= {1,5,7} //as DEMO silvio
DEFINE BRUSH oBrush COLOR CLR_BLACK
PRINT oPrn NAME OemToAnsi( "Silvio Print" ) PREVIEW
DEFINE PEN oPen WIDTH 2 OF oPrn
PAGE // printing the circles form
Print_Numbers(oPrn,oPen,aNumbers,oBrush)
Print_Ruote(oPrn,oPen,aRoutes,oBrush)
ENDPAGE
ENDPRINT
oBrush:End()
oPen:End()
RETURN NIL
FUNCTION MsgSelect( aItems, cValue, cTitle )
//------------------------------------------
LOCAL oDlg
DEFAULT cTitle := "Please, select"
DEFINE DIALOG oDlg FROM 5,10 TO 24, 55 TITLE cTitle
@ 1, 7 LISTBOX cValue ITEMS aItems SIZE 70, 90 OF oDlg
@ 7, 7 BUTTON "&OK" OF oDlg SIZE 40, 12 ;
ACTION oDlg:End() DEFAULT
@ 7, 17 BUTTON "&Cancel" OF oDlg SIZE 40, 12 ;
ACTION ( cValue := nil, oDlg:End() )
ACTIVATE DIALOG oDlg CENTERED
RETURN( val( alltrim( cValue ) ) )
//----------------------------------------------------------------//
Function Print_Numbers(oPrn,oPen,aNumbers,oBrush)
local n,o
local nI
local ntop,nLeft,nBottom,nright,aRect
local nvar:= 1
local nRow,nCol
//circles
for n := 1 to 9
for o := 1 to 10
nTop := _MARGIN_TOP + ( ( n - 1 ) * _YSPACE )
nLeft := _MARGIN_LEFT + ( ( o - 1 ) * _XSPACE )
nBottom := nTop + _CIRCLE
nRight := nLeft + _CIRCLE
oPrn:Cmtr2Pix( @nTop, @nLeft )
oPrn:Cmtr2Pix( @nBottom, @nRight )
oPrn:Ellipse( nTop, nLeft, nBottom, nRight, oPen )
next
next
//Numbers
For nI= 1 to Len(aNumbers)
nVar:=aNumbers[nI]
nRow := int( nVar / 10 )
nCol := ( nVar % 10 )
if nCol == 0
nCol := 10
else
++nRow
endif
nTop := _MARGIN_TOP + .1 + ( --nRow * _YSPACE ) // + .1 to make square smaller than circle
nLeft := _MARGIN_LEFT + .1 + ( --nCol * _XSPACE ) // + .1 to make square smaller than circle
nBottom := nTop - .2 + _CIRCLE // - .2 to make square smaller than circle
nRight := nLeft - .2 + _CIRCLE // - .2 to make square smaller than circle
oPrn:Cmtr2Pix( @nTop, @nLeft )
oPrn:Cmtr2Pix( @nBottom, @nRight )
aRect := { nTop, nLeft , nBottom , nRight }
oPrn:FillRect( aRect, oBrush )
Next
return nil
//----------------------------------------------------------------------//
#define _MARGIN_WITH 9
#define _SQUARE 0.4 // each circle has 2 mm in diameter
Function Print_Ruote(oPrn,oPen,aRoutes,oBrush)
local n,o
local ntop,nLeft,nBottom,nright,aRect
local nI
local nvar:= 1
local nRow,nCol
for n := 1 to 12
for o := 1 to 1
nTop := _MARGIN_TOP + ( ( n - 2 ) * _YSPACE -0.2)
nLeft :=_MARGIN_WITH + ( ( o - 1 ) * _XSPACE )
nBottom := nTop + _SQUARE
nRight := nLeft + _SQUARE
oPrn:Cmtr2Pix( @nTop, @nLeft )
oPrn:Cmtr2Pix( @nBottom, @nRight )
* oPrn:Ellipse( nTop, nLeft, nBottom, nRight, oPen )
*oPrn:Box( nTop, nLeft, nBottom, nRight, oPen)
oPrn:RoundBox( nTop, nLeft, nBottom, nRight, _SQUARE, _SQUARE, oPen)
next
next
For nI= 1 to Len(aRoutes)
nVar:=aRoutes[nI]
nRow := int( nVar / 10 )
nCol := ( nVar % 1 )
if nCol == 0
nCol := 1
else
++nRow
endif
nTop := _MARGIN_TOP + .1 + ( --nRow * _YSPACE - 0.2) // + .1 to make square smaller than circle
nLeft := _MARGIN_WITH + .1 + ( --nCol * _XSPACE ) // + .1 to make square smaller than circle
nBottom := nTop - .2 + _SQUARE // - .2 to make square smaller than circle
nRight := nLeft - .2 + _SQUARE // - .2 to make square smaller than circle
oPrn:Cmtr2Pix( @nTop, @nLeft )
oPrn:Cmtr2Pix( @nBottom, @nRight )
aRect := { nTop, nLeft , nBottom , nRight }
oPrn:FillRect( aRect, oBrush )
Next
return nil