Skip to main content
All docs
V25.1
  • WatermarkCollection.AddRange(Watermark[]) Method

    Adds the specified watermarks to WatermarkCollection.

    Namespace: DevExpress.XtraPrinting.Drawing

    Assembly: DevExpress.Printing.v25.1.Core.dll

    NuGet Package: DevExpress.Printing.Core

    Declaration

    public void AddRange(
        Watermark[] items
    )

    Parameters

    Name Type Description
    items Watermark[]

    An array of Watermark objects.

    Remarks

    This example demonstrates how to add watermarks to a report document.

    using System.Drawing;
    using DevExpress.XtraPrinting.Drawing;
    using DevExpress.Drawing;
    
    public partial class XtraReport1 : DevExpress.XtraReports.UI.XtraReport {
       public XtraReport1() {
          InitializeComponent();
          Watermark pictureWatermark = new Watermark();
    
          // Set watermark options.
          pictureWatermark.Image = Bitmap.FromFile("watermark.png");
          pictureWatermark.ImageAlign = ContentAlignment.TopCenter;
          pictureWatermark.ImageTiling = false;
          pictureWatermark.ImageViewMode = ImageViewMode.Stretch;
          pictureWatermark.ImageTransparency = 150;
          pictureWatermark.ImagePosition = WatermarkPosition.Behind;
          pictureWatermark.PageRange = "1"; 
          Watermark textWatermark = new Watermark();
          // Set watermark options.
          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";
          // Add watermarks to the collection.
          Watermarks.AddRange(new Watermark[] { pictureWatermark, textWatermark });
          }
    }
    
    See Also