Finally, we have this feature in FoxyPreviewer too ! That means that from now on, you can add watermarks to your reports without having absolutely any knowledge about GDI+ or ReportListeners, just by setting some few properties! In fact, by filling just one property you can have watermarks in all pages of your reports. In fact, this feature was asked by many people, but I had to postpone it because I had to implement to the original Gdi+ classes some new classes and functions, to create the transparencies and grey-scale effects. If you're curious, and want to check for these functions, have a look at the file pr_gdiplushelper.prg in the sources folder.
The usage is, as always, super simple. The only requirement is that you use FoxyPreviewer in the simplified mode.
cWatermarkImage - character, the name of the WM image. Important: this image MUST be stored locally, CAN'T be embedded in your EXE, obligatory property if you want to show the watermark. To remove the watermark from the next reports, just store an empty value to this property.
nWatermarkType - numeric, 1 = Colored (default), 2 = Converts the source image to grey scale, optional property
nWatermarkTransparency - numeric, from .10 to 1, default = 0.25, the transparency level of the WM image; 1 = Opaque, optional property
nWaterMarkWidthRatio - numeric, default = 0.75, the width size in proportion of the watermark in the report page, optional property
nWaterMarkHeightRatio - numeric, default = 0.75, the height size in proportion of the watermark in the report page, optional property
DO FoxyPreviewer.App * Adding watermarks to reports _Screen.oFoxyPreviewer.cWatermarkImage = ADDBS(HOME()) + "Graphics\Gifs\Morphfox.gif" _Screen.oFoxyPreviewer.nWaterMarkType = 1 && 1 = Colored (default), 2 = B&W _Screen.oFoxyPreviewer.nWatermarktransparency = .30 && (0-1) Transparency, 0 = Transparent, 1 = Opaque _Screen.oFoxyPreviewer.nWaterMarkWidthRatio = .75 && (0-1) Proportion that the WM will occupy in page width _Screen.oFoxyPreviewer.nWaterMarkHeightRatio = .75 && (0-1) Proportion that the WM will occupy in page height REPORT FORM LOCFILE(_Samples + "\Solution\Reports\Colors.frx") PREVIEW
If you only set the "cWatermarkImage" property to a valid image file existing on the disk, you'll have your first watermark.
To reset your reports to the original settings, without the watermark, just clear the value of the property '.cWatermarkImage = "" '.
Below you can see how the watermarks will appear, depending on the property values that you choose:
.nWatermarkType = 1 && 1 = colored ; 2 = greyscale .nWatermarkTransparency = 1 && 0 = transparent ; 1 = opaque .nWatermarkWidthRatio = 0.90 && 0 - 1 .nWatermarkHeightRatio = 0.90 && 0 - 1
.nWatermarkType = 1 && 1 = colored ; 2 = greyscale .nWatermarkTransparency = 0.25 && 0 = transparent ; 1 = opaque .nWatermarkWidthRatio = 0.50 && 0 - 1 .nWatermarkHeightRatio = 0.50 && 0 - 1
.nWatermarkType = 2 && 1 = colored ; 2 = greyscale .nWatermarkTransparency = 0.10 && 0 = transparent ; 1 = opaque .nWatermarkWidthRatio = 1.00 && 0 - 1 .nWatermarkHeightRatio = 1.00 && 0 - 1
.nWatermarkType = 2 && 1 = colored ; 2 = greyscale .nWatermarkTransparency = 0.25 && 0 = transparent ; 1 = opaque .nWatermarkWidthRatio = 0.75 && 0 - 1 .nWatermarkHeightRatio = 0.75 && 0 - 1