home *** CD-ROM | disk | FTP | other *** search
- '****************************************************************************
- ' TESTDEV.BAS
- '
- ' This sample program demontsrates the use of the Device Info Functions.
- '****************************************************************************
- '$INCLUDE: 'PGL.BAS'
-
- port% = pgPORTRAIT
- psize% = pgHALFPAGE
- dfile$ = "TESTDEV.PLT"
- name$ = "HPLJET"
-
- print "Loading :",name$
- ierr% = pgLoadDevInfo% ( name$ )
- if ierr% <> 0 then
- print "Err=",ierr%," Cannot find "+name$+".DRV"
- goto exitpgm
- end if
-
- '
- ' Select Page formatting/size options.
- ' This must be done prior to calling pgGetDevMaxX,pgGetDevMaxY
- '
- call pgSetPageMargins ( 100,100,100,100)
- call pgSetPageForm ( port% )
- call pgSetPageSize ( psize% )
-
- '
- ' Get General Device Info
- '
- nres% = pgGetDevModes%
- dtype% = pgGetDevType%
- dheight%= pgGetDevHeight%
- dwidth% = pgGetDevWidth%
- pox% = pgGetDevOffsetX%
- poy% = pgGetDevOffsetY%
-
- print " Device Parameters-----"
- print " No. Of Res Modes: ",nres%
- print " Dev Type: ",dtype%
- print " Dev Height: ",dheight%
- print " Dev Width: ",dwidth%
- print " Dev Offset-X: ",pox%
- print " Dev Offset-Y: ",poy%
-
- '
- ' Get Resolution Dependent Device Info, on highest res supported
- '
- res% = nres%-1
- dpix% = pgGetDevResX%( res% )
- dpiy% = pgGetDevResY%( res% )
- nplanes% = pgGetDevPlanes%( res% )
- ncolors% = pgGetDevColors%( res% )
- maxX% = pgGetDevMaxX%( res% )
- maxY% = pgGetDevMaxY%( res% )
-
- print " Resolution Dependent Device Parameters----"
- print " RES: ",res%
- print " DPI-X: ",dpix%
- print " DPI-Y: ",dpiy%
- print " No. Of Planes: ",nplanes%
- print " No. Of Colors: ",ncolors%
- print " MaxX: ",maxX%
- print " MaxY: ",maxY%
-
- '
- ' Open A Drawing File, set size to the exact physical device/page
- ' specific dwidth and dheight dimensions. Now your working in hardware
- ' coordinates.
- '
- call pgInitDrw( dfile$, maxX%+1, maxY%+1, ierr% )
-
- if ierr% <> 0 then
- print "Error Opening a Drawing File !"
- goto exitpgm
- endif
-
- if ncolors% = 2 then
- ' Black Pen on white paper for B&W a printer
- call pgSetColor(1)
- else
- ' Black Pen on White paper on Color a printer
- call pgSetColor(0)
- end if
-
- call pgRectangle( 0, 0, maxX%, maxY%, pgOUTLINE )
- call pgRectangle(20, 20, maxX%-20, maxY%-20, pgOUTLINE )
-
- call pgSetTextStyle( pgTRIPLEX )
- call pgSetTextJustify( pgCENTER, pgCENTER )
- call pgSetTextScaling( 5,1,5,1 )
- call pgDrawTextXY(maxX%/2,maxY%/2,"Hello World")
- '
- ' Close The Drawing File.
- '
- call pgEndDrw
- '
- exitpgm:
- END