by vensanto » Fri Jan 06, 2006 11:37 am
I have created the method EMF( cfile, right, left, top, bottom )
METHOD EMF( cFile, left, right, top, bottom ) CLASS TPrinter
Local hMeta,oRect
Local aData:=PrnGetSize( ::hDC )
IF ! FILE( cFile )
Return nil
Endif
SaveDC( ::hDCOut )
hMeta:=GetEnhMetaFile( cFile )
::SetIsoTropicMode()
::SetWindowExt( aData[1], aData[2] )
::SetViewPortExt( aData[1], aData[2] )
SetViewOrg( ::hDCOut, -1, -1 )
STRUCT oRect
MEMBER nLeft AS LONG
MEMBER nTop AS LONG
MEMBER nRight AS LONG
MEMBER nBottom AS LONG
ENDSTRUCT
oRect:nLeft := left
oRect:nTop := top
oRect:nRight := aData[1] - right - ::nXoffset - ::nXoffset
oRect:nBottom := aData[2] - bottom - ::nYoffset - ::nYoffset
SetBkMode( ::hDCOut, 1 )
PlayEMF( ::hDCOut, hMeta, oRect:cBuffer , .T. )
DeleteEnhMetafile( hMeta )
RestoreDC( ::hDCOut )
Return nil
DLL32 FUNCTION PLAYEMF( hDC AS LONG, hEMF AS LONG, cRect AS LPSTR ) AS BOOL;
PASCAL FROM "PlayEnhMetaFile" LIB "gdi32.dll"