Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Watermark
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01240837
Message ID:
01242099
Views:
35
Thanks, I will test it. But all this depends on the .NET framework being installed on the computer, right?

>Russel,
>
>>Where is that new version, anyway?
>
>In my first message to you in this thread I sent you a link to get that new version.
>
>Anyway, forget it now.
>
>Please test this one, and tell me how it works.
>You'll find instructions on how to use it here:
>Watermark your reports with GdiPlusX
>http://weblogs.foxite.com/cesarchalom/archive/2007/07/17/4405.aspx
>
>I've created a new version, and would apreciate if you could test it with your report.
>
>In this version I've added a RenderType property, that will tell the listener if the watermark is to be drawn before or after the page is rendered. Some other slight modifications will improve the speed for the case of reports that contain more than one page.
>
>Please try switching the property "RenderType" from 2 to 1, and check if there's a difference in the final result.
>
>
_SCREEN.AddProperty("System", NEWOBJECT("xfcSystem", LOCFILE("system.vcx","vcx")))
>
>LOCAL loListener as ReportListener
>loListener = CREATEOBJECT("WatermarkListener")
>
>loListener.LISTENERTYPE = 1
>loListener.WaterMarkImage = HOME() + "Graphics\Gifs\morphfox.gif"
>loListener.WaterMarkType = 1 && 1 = Colored ; 2 = GreyScale
>loListener.WaterMarkTransparency = 0.25 && 0 = transparent ; 1 = Opaque
>loListener.WaterMarkWidthRatio = 0.75   && 0 - 1
>loListener.WaterMarkHeightRatio = 0.75  && 0 - 1
>loListener.RenderType = 2 && 1 = Before rendering page ; 2 = After rendering page
>
>* Run the report using the new report engine (object-assisted output)
>REPORT FORM (ADDBS(HOME()) + "samples/solution/europa/employeesmd.frx") OBJECT loListener
>
>RETURN
>
>
>
>
>
>DEFINE CLASS WatermarkListener AS _ReportListener OF HOME() + "FFC\" + "_ReportListener.VCX"
>	NewPage = .T.
>	WaterMarkImage = ""
>	WaterMarkType = 1 && 1 = Colored ; 2 = GreyScale
>	WaterMarkTransparency = 0.50 && 0 = transparent ; 1 = Opaque
>	WaterMarkWidthRatio = 0.50
>	WaterMarkHeightRatio = 0.50
>	RenderType = 1 && 1 = Before rendering page ; 2 = After rendering page
>	oGDIGraphics = NULL
>	oBmp         = NULL
>	oImgAttrib   = NULL
>	oRect        = NULL
>	
>	FUNCTION BEFOREREPORT
>		DODEFAULT()
>
>		WITH _SCREEN.SYSTEM.Drawing
>
>			This.oGDIGraphics = .Graphics.New()
>
>			LOCAL lnX, lnY, lnWidth, lnHeight
>			lnX = (1 - This.WaterMarkWidthRatio) / 2
>			lnY = (1 - This.WaterMarkHeightRatio) / 2
>			lnWidth = This.WaterMarkWidthRatio
>			lnHeight = This.WaterMarkHeightRatio
>
>			* Create a Rectangle of the size of 60% of the report page
>			This.oRect = .Rectangle.New(lnX * This.sharedPageWidth, ;
>					lnY * This.sharedPageHeight, ;
>					This.sharedPageWidth * lnWidth, ;
>					This.sharedPageHeight * lnHeight)
>
>			* Load the Image File to GDI+
>			This.oBmp = .Bitmap.New(This.WaterMarkImage)
>
>			* Create a color matrix
>			LOCAL loClrMatrix AS xfcColorMatrix
>			IF This.WaterMarkType = 2 && 1 = Colored ; 2 = GreyScale
>				loClrMatrix = .Imaging.ColorMatrix.New( ;
>			        .33, .33, .33, 0  , 0, ;
>		    	    .33, .33, .33, 0  , 0, ;
>		        	.33, .33, .33, 0  , 0, ;
>			        0, 0, 0, This.WaterMarkTransparency, 0, ;
>			        0, 0, 0, 0, 0)
>			ELSE
>				loClrMatrix = .Imaging.ColorMatrix.New()
>				loClrMatrix.Matrix33 = This.WaterMarkTransparency
>			ENDIF 				
>
>			* Create an ImageAttributes and associate the ClrMatrix to it
>			This.oImgAttrib = .Imaging.ImageAttributes.New()
>			This.oImgAttrib.SetColorMatrix(loClrMatrix)
>
>		ENDWITH
>	ENDFUNC
>
>	FUNCTION BEFOREBAND(nBandObjCode, nFRXRecNo)
>		#DEFINE FRX_OBJCOD_PAGEHEADER 1
>		IF nBandObjCode==FRX_OBJCOD_PAGEHEADER AND This.RenderType = 1 && Before the page is rendered
>			This.DrawWatermark()
>		ENDIF
>		DODEFAULT(nBandObjCode, nFRXRecNo)
>	ENDFUNC
>
>	PROCEDURE AfterBand(nBandObjCode, nFRXRecNo)
>		#DEFINE FRX_OBJCOD_PAGEFOOTER 7
>		IF nBandObjCode==FRX_OBJCOD_PAGEFOOTER AND This.RenderType = 2 && After the page is rendered
>			This.DrawWatermark()
>		ENDIF
>		DODEFAULT(nBandObjCode, nFRXRecNo)
>	ENDPROC
>
>	PROCEDURE DrawWatermark
>		IF NOT EMPTY(This.WatermarkImage)
>
>			* Get GDI+ Graphics handle
>			IF NOT This.IsSuccessor
>				This.SharedGDIPlusGraphics = This.GDIPLUSGRAPHICS
>			ENDIF
>			This.oGDIGraphics.Handle = This.SharedGDIPlusGraphics
>
>			* Draw the watermark
>			This.oGdiGraphics.DrawImage(This.oBmp, This.oRect, This.oBmp.GetBounds(), 2, This.oImgAttrib)
>		ENDIF
>	ENDPROC 	
>
>ENDDEFINE
eCost.com continues to rip people off
Check their rating at ResellerRatings.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform