* contrib\gtwvg\wvg3stat.prg
* contrib\gtwvg\wvgax.prg
* contrib\gtwvg\wvgcheck.prg
* contrib\gtwvg\wvgclass.prg
* contrib\gtwvg\wvgcombo.prg
* contrib\gtwvg\wvgcrt.prg
* contrib\gtwvg\wvgdarea.prg
* contrib\gtwvg\wvgdatar.prg
* contrib\gtwvg\wvgdlg.prg
* contrib\gtwvg\wvggenrc.prg
* contrib\gtwvg\wvghtmlv.prg
* contrib\gtwvg\wvglistb.prg
* contrib\gtwvg\wvgmenub.prg
* contrib\gtwvg\wvgmle.prg
* contrib\gtwvg\wvgpaint.prg
* contrib\gtwvg\wvgphdlr.prg
* contrib\gtwvg\wvgpushb.prg
* contrib\gtwvg\wvgradio.prg
* contrib\gtwvg\wvgscrlb.prg
* contrib\gtwvg\wvgsle.prg
* contrib\gtwvg\wvgstatb.prg
* contrib\gtwvg\wvgstatc.prg
* contrib\gtwvg\wvgsysw.prg
* contrib\gtwvg\wvgtabpg.prg
* contrib\gtwvg\wvgtoolb.prg
* contrib\gtwvg\wvgtreev.prg
* contrib\gtwvg\wvgwnd.prg
* contrib\hbblat\blatcls.prg
* contrib\hbblink\blinker.prg
* contrib\hbcomm\comm.prg
* contrib\hbct\ctmisc.prg
* contrib\hbct\ctrand.prg
* contrib\hbct\cttime.prg
* contrib\hbct\fcopy.prg
* contrib\hbct\getinfo.prg
* contrib\hbct\getinput.prg
* contrib\hbct\getsecrt.prg
* contrib\hbct\keysec.prg
* contrib\hbct\keytime.prg
* contrib\hbct\kxlat.prg
* contrib\hbct\screen3.prg
* contrib\hbct\scrmark.prg
* contrib\hbct\showtime.prg
* contrib\hbct\tempfile.prg
* contrib\hbfbird\tests\test.prg
* contrib\hbfbird\tfirebrd.prg
* contrib\hbgd\gd.prg
* contrib\hbgd\gdbar.prg
* contrib\hbgd\gdbarcod.prg
* contrib\hbgd\gdchart.prg
* contrib\hbmisc\calldll.prg
* contrib\hbmisc\hbedit.prg
* contrib\hbmisc\udpds.prg
* contrib\hbmysql\tmysql.prg
* contrib\hbmysql\tsqlbrw.prg
* contrib\hbodbc\browodbc.prg
* contrib\hbodbc\todbc.prg
* contrib\hbpgsql\tpostgre.prg
* contrib\hbqt\qtcore\hbqt_misc.prg
* contrib\hbrun\hbrun.prg
* contrib\hbsms\sms.prg
* contrib\hbsqlit3\hdbcsqlt.prg
* contrib\hbtip\cgi.prg
* contrib\hbtip\client.prg
* contrib\hbtip\encb64.prg
* contrib\hbtip\encoder.prg
* contrib\hbtip\ftpcli.prg
* contrib\hbtip\httpcli.prg
* contrib\hbtip\log.prg
* contrib\hbtip\mail.prg
* contrib\hbtip\popcli.prg
* contrib\hbtip\sendmail.prg
* contrib\hbtip\smtpcli.prg
* contrib\hbtip\thtml.prg
* contrib\hbtip\url.prg
* contrib\hbtpathy\telepath.prg
* contrib\hbwin\tests\testprn.prg
* contrib\hbwin\wce_sim.prg
* contrib\hbwin\win_os.prg
* contrib\hbwin\win_reg.prg
* contrib\hbwin\win_tbmp.prg
* contrib\hbwin\win_tprn.prg
* contrib\hbxbp\hbpprocess.prg
* contrib\hbxbp\xbp3state.prg
* contrib\hbxbp\xbpbrowse.prg
* contrib\hbxbp\xbpcheckbox.prg
* contrib\hbxbp\xbpcombobox.prg
* contrib\hbxbp\xbpcrt.prg
* contrib\hbxbp\xbpdataref.prg
* contrib\hbxbp\xbpdialog.prg
* contrib\hbxbp\xbpfiledialog.prg
* contrib\hbxbp\xbpfontdialog.prg
* contrib\hbxbp\xbpgeneric.prg
* contrib\hbxbp\xbpgra.prg
* contrib\hbxbp\xbphtmlviewer.prg
* contrib\hbxbp\xbplistbox.prg
* contrib\hbxbp\xbpmenubar.prg
* contrib\hbxbp\xbpmle.prg
* contrib\hbxbp\xbpparthandler.prg
* contrib\hbxbp\xbppresspace.prg
* contrib\hbxbp\xbpprintdialog.prg
* contrib\hbxbp\xbpprinter.prg
* contrib\hbxbp\xbppushbutton.prg
* contrib\hbxbp\xbpradiobutton.prg
* contrib\hbxbp\xbprtf.prg
* contrib\hbxbp\xbpscrollbar.prg
* contrib\hbxbp\xbpsle.prg
* contrib\hbxbp\xbpspinbutton.prg
* contrib\hbxbp\xbpstatic.prg
* contrib\hbxbp\xbpstatusbar.prg
* contrib\hbxbp\xbpstyle.prg
* contrib\hbxbp\xbptabpage.prg
* contrib\hbxbp\xbptoolbar.prg
* contrib\hbxbp\xbptreeview.prg
* contrib\hbxbp\xbpwindow.prg
* contrib\hbxpp\dbfuncsx.prg
* contrib\hbxpp\runshell.prg
* contrib\hbxpp\thfuncx.prg
* contrib\hbxpp\tthreadx.prg
* contrib\xhb\cstruct.prg
* contrib\xhb\dbgfx.prg
* contrib\xhb\dirrec.prg
* contrib\xhb\dumpvar.prg
* contrib\xhb\hbcomprs.prg
* contrib\xhb\hblog.prg
* contrib\xhb\hjwindow.prg
* contrib\xhb\hterrsys.prg
* contrib\xhb\htmutil.prg
* contrib\xhb\sprintf.prg
* contrib\xhb\tedit.prg
* contrib\xhb\tframe.prg
* contrib\xhb\thtm.prg
* contrib\xhb\trpc.prg
* contrib\xhb\trpccli.prg
* contrib\xhb\ttable.prg
* contrib\xhb\xcstr.prg
* contrib\xhb\xdbmodst.prg
* contrib\xhb\xhberr.prg
* contrib\xhb\xhbmemo.prg
* contrib\xhb\xhbmt.prg
* contrib\xhb\xhbtedit.prg
* contrib\xhb\xhbver.prg
* examples\guestbk\inifiles.prg
* examples\hbdoc2\genhtml.prg
* examples\hbdoc2\hbdoc2.prg
* examples\hbvpdf\hbvpdf.prg
* examples\hbvpdf\hbvpdft.prg
* examples\httpsrv\uhttpd.prg
* examples\rddado\adordd.prg
* IS*() macros converted to HB_IS*() function calls.
(using full uppercase to make them stand out)
% deleted '#include "common.ch"' where possible
157 lines
5.8 KiB
Plaintext
157 lines
5.8 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
#include "hbwin.ch"
|
|
|
|
PROCEDURE Main( cPar1 )
|
|
LOCAL nPrn := 1
|
|
LOCAL cBMPFile := Space( 40 )
|
|
LOCAL aPrn := WIN_PRINTERLIST()
|
|
LOCAL GetList := {}
|
|
|
|
CLS
|
|
|
|
IF Empty( aPrn )
|
|
Alert("No printers installed - Cannot continue")
|
|
QUIT
|
|
ENDIF
|
|
|
|
DO WHILE nPrn != 0
|
|
CLS
|
|
@ 0, 0 SAY "Win_Prn() Class test program. Choose a printer to test"
|
|
@ 1, 0 SAY "Bitmap file name" GET cBMPFile PICT "@K"
|
|
READ
|
|
@ 2, 0 TO MaxRow(), MaxCol()
|
|
nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn )
|
|
IF nPrn != 0
|
|
PrnTest( aPrn[ nPrn ], cBMPFile, iif( HB_ISSTRING( cPar1 ) .AND. Lower( cPar1 ) == "ask", .T., NIL ) )
|
|
ENDIF
|
|
ENDDO
|
|
|
|
RETURN
|
|
|
|
STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk )
|
|
LOCAL oPrinter := Win_Prn():New( cPrinter )
|
|
LOCAL aFonts
|
|
LOCAL x
|
|
LOCAL nColFixed
|
|
LOCAL nColTTF
|
|
LOCAL nColCharSet
|
|
|
|
oPrinter:Landscape := .F.
|
|
oPrinter:FormType := WIN_DMPAPER_A4
|
|
oPrinter:Copies := 1
|
|
IF HB_ISLOGICAL( lAsk )
|
|
oPrinter:AskProperties := lAsk
|
|
ENDIF
|
|
|
|
IF ! oPrinter:Create()
|
|
Alert( "Cannot Create Printer" )
|
|
ELSE
|
|
IF ! oPrinter:startDoc( "Win_Prn(Doc name in Printer Properties)" )
|
|
Alert( "StartDoc() failed" )
|
|
ELSE
|
|
oPrinter:SetPen( WIN_PS_SOLID, 1, HB_WIN_RGB_RED )
|
|
oPrinter:Bold( WIN_FW_EXTRABOLD )
|
|
oPrinter:TextOut( oPrinter:PrinterName + ": MaxRow() = " + Str( oPrinter:MaxRow(), 4 ) + " MaxCol() = " + Str( oPrinter:MaxCol(), 4 ) )
|
|
oPrinter:Bold( WIN_FW_DONTCARE )
|
|
oPrinter:NewLine()
|
|
oPrinter:TextOut(" Partial list of available fonts that are available for OEM_")
|
|
oPrinter:NewLine()
|
|
oPrinter:UnderLine( .T. )
|
|
oPrinter:Italic( .T. )
|
|
// oPrinter:SetFont( "Courier New", 7, { 3, -50 } ) // Compressed print
|
|
nColFixed := 40 * oPrinter:CharWidth
|
|
nColTTF := 48 * oPrinter:CharWidth
|
|
nColCharSet := 60 * oPrinter:CharWidth
|
|
oPrinter:TextOut( "FontName" )
|
|
oPrinter:SetPos( nColFixed )
|
|
oPrinter:TextOut( "Fixed?" )
|
|
oPrinter:SetPos( nColTTF )
|
|
oPrinter:TextOut( "TrueType?" )
|
|
oPrinter:SetPos( nColCharset )
|
|
oPrinter:TextOut( "CharSet#", .T. )
|
|
oPrinter:NewLine()
|
|
oPrinter:Italic( .F. )
|
|
oPrinter:UnderLine( .F. )
|
|
aFonts := oPrinter:GetFonts()
|
|
oPrinter:NewLine()
|
|
FOR x:= 1 TO Len( aFonts ) STEP 2
|
|
oPrinter:CharSet( aFonts[ x, 4 ] )
|
|
IF oPrinter:SetFont( aFonts[ x, 1 ] ) // Could use "IF oPrinter:SetFontOk" after call to oPrinter:SetFont()
|
|
IF oPrinter:FontName == aFonts[ x, 1 ] // Make sure Windows didn't pick a different font
|
|
oPrinter:TextOut( aFonts[ x, 1 ] )
|
|
oPrinter:SetPos( nColFixed )
|
|
oPrinter:TextOut( iif( aFonts[ x, 2 ], "Yes", "No" ) )
|
|
oPrinter:SetPos( nColTTF )
|
|
oPrinter:TextOut( iif( aFonts[ x, 3 ], "Yes", "No" ) )
|
|
oPrinter:SetPos( nColCharSet )
|
|
oPrinter:TextOut( Str( aFonts[ x, 4 ], 5 ) )
|
|
oPrinter:SetPos( oPrinter:LeftMargin, oPrinter:PosY + ( oPrinter:CharHeight * 2 ) )
|
|
IF oPrinter:PRow() > oPrinter:MaxRow() - 16 // Could use "oPrinter:NewPage()" to start a new page
|
|
EXIT
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
oPrinter:Line( 0, oPrinter:PosY + 5, 2000, oPrinter:PosY + 5 )
|
|
NEXT
|
|
oPrinter:SetFont( "Lucida Console", 8, { 3, -50 } ) // Alternative Compressed print
|
|
oPrinter:CharSet( 0 ) // Reset default charset
|
|
oPrinter:Bold( WIN_FW_EXTRABOLD )
|
|
oPrinter:NewLine()
|
|
oPrinter:TextOut( "This is on line" + Str( oPrinter:Prow(), 4 ) + ", Printed bold, " )
|
|
oPrinter:TextOut( " finishing at Column: " )
|
|
oPrinter:TextOut( Str( oPrinter:Pcol(), 4 ) )
|
|
oPrinter:SetPrc( oPrinter:Prow() + 3, 0 )
|
|
oPrinter:Bold( WIN_FW_DONTCARE )
|
|
oPrinter:TextOut( "Notice: UNDERLINE only prints correctly if there is a blank line after", .T. )
|
|
oPrinter:TextOut( " it. This is because of :LineHeight and the next line", .T. )
|
|
oPrinter:TextOut( " printing over top of the underline. To avoid this happening", .T. )
|
|
oPrinter:TextOut( " you can to alter :LineHeight or use a smaller font, or use :SetBkMode( WIN_TRANSPARENT )" )
|
|
oPrinter:NewLine()
|
|
oPrinter:NewLine()
|
|
oPrinter:SetFont( "Lucida Console", 18, 0 ) // Large print
|
|
oPrinter:SetColor( HB_WIN_RGB_GREEN )
|
|
oPrinter:TextOut( "Finally some larger print" )
|
|
oPrinter:Box( 0, oPrinter:PosY + 100, 100, oPrinter:PosY + 200 )
|
|
oPrinter:Arc( 200, oPrinter:PosY + 100, 300, oPrinter:PosY + 200 )
|
|
oPrinter:Ellipse( 400, oPrinter:PosY + 100, 500, oPrinter:PosY + 200 )
|
|
oPrinter:FillRect( 600, oPrinter:PosY + 100, 700, oPrinter:PosY + 200, HB_WIN_RGB_RED )
|
|
|
|
// To print a barcode;
|
|
// Replace 'BCod39HN' with your own bar code font or any other font
|
|
// oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ), oPrinter:MM_TO_POSY( 60 ), "1234567890", "BCod39HN", 24, 0 )
|
|
//
|
|
PrintBitMap( oPrinter, cBMPFile )
|
|
|
|
oPrinter:EndDoc()
|
|
ENDIF
|
|
oPrinter:Destroy()
|
|
ENDIF
|
|
|
|
RETURN
|
|
|
|
STATIC PROCEDURE PrintBitMap( oPrn, cBitFile )
|
|
LOCAL oBMP
|
|
|
|
IF Empty( cBitFile )
|
|
*
|
|
ELSEIF ! hb_FileExists( cBitFile )
|
|
Alert( cBitFile + " not found " )
|
|
ELSE
|
|
oBMP := Win_BMP():New()
|
|
IF oBmp:loadFile( cBitFile )
|
|
|
|
oBmp:Draw( oPrn, { 200, 200, 2000, 1500 } )
|
|
|
|
// Note: Can also use this method to print bitmap
|
|
// oBmp:Rect := { 200, 200, 2000, 1500 }
|
|
// oPrn:DrawBitMap( oBmp )
|
|
|
|
ENDIF
|
|
oBMP:Destroy()
|
|
ENDIF
|
|
|
|
RETURN
|