Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XRWatermark Class

A watermark in a report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

#Declaration

public class XRWatermark :
    Watermark

#Remarks

Use the XtraReport.Watermarks property to access an XRWatermark object and its members.

See Display Watermarks in a Report for information on how to add a watermark to a report at design time.

#Example

This example demonstrates how to add a watermark to a report. The SetTextWatermark method demonstrates the properties you can use to add a text watermark to a report; the SetPictureWatermark method demonstrates properties required to set a picture as the report’s watermark.

using System.Drawing;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Drawing;
using DevExpress.Drawing;
// ...
public void SetTextWatermark(XtraReport report) {
    // Create a new watermark.
    Watermark textWatermark = new Watermark();
    // Specify watermark settings.
    textWatermark.Text = "CUSTOM WATERMARK TEXT";
    textWatermark.TextDirection = DirectionMode.ForwardDiagonal;
    textWatermark.Font = new DXFont(textWatermark.Font.Name, 40);
    textWatermark.ForeColor = Color.DodgerBlue;
    textWatermark.TextTransparency = 150;
    textWatermark.TextPosition = WatermarkPosition.InFront;
    textWatermark.PageRange = "1,3-5";
    textWatermark.Id = "Watermark1";
    // Add the watermark to the collection.
    report.Watermarks.Add(textWatermark);
}
public void SetPictureWatermark(XtraReport report) {
    Watermark pictureWatermark = new Watermark();
    pictureWatermark.ImageSource = ImageSource.FromFile("Watermark.png");
    pictureWatermark.ImageAlign = ContentAlignment.TopCenter;
    pictureWatermark.ImageTiling = false;
    pictureWatermark.ImageViewMode = ImageViewMode.Stretch;
    pictureWatermark.ImageTransparency = 150;
    pictureWatermark.ImagePosition = WatermarkPosition.Behind;
    pictureWatermark.PageRange = "2,4";
    pictureWatermark.Id = "Watermark2";
    report.Watermarks.Add(pictureWatermark);
}

#Inheritance

Object
DevExpress.Printing.Utils.DocumentStoring.StorableObjectBase
See Also