Spread Windows Forms 15.0
Spread Windows Forms 15.0 Product Documentation / Developer's Guide / Printing / Customizing the Appearance of the Printing / Adding a Watermark to a Printed Page
In This Topic
    Adding a Watermark to a Printed Page
    In This Topic

    You can print a background image or a watermark when the spreadsheet is printed.

    Set the PrintBackground event to fire when printing, and specify the graphic with the PrintBackground event, and the opacity with the PrintInfo.Opacity property, so the printing of the spreadsheet has no watermark if opacity is highest (transparency is lowest) and shows the watermark through the spreadsheet if the opacity is low (transparency is high).

    Using Code

    Use the PrintInfo object to specify the opacity for printing a watermark.


    This example shows how to print a watermark.

    Copy Code
    private void fpSpread1_PrintBackground(object sender, FarPoint.Win.Spread.PrintBackgroundEventArgs e)
        FarPoint.Win.Picture pic = new FarPoint.Win.Picture(System.Drawing.Image.FromFile("D:\\Files\\cover.jpg"), FarPoint.Win.RenderStyle.Normal);
        pic.AlignHorz = FarPoint.Win.HorizontalAlignment.Left;
        pic.AlignVert = FarPoint.Win.VerticalAlignment.Top;
        pic.Paint(e.Graphics, e.SheetRectangle);
    private void button1_Click(object sender, System.EventArgs e)
        FarPoint.Win.Spread.PrintInfo pi = new FarPoint.Win.Spread.PrintInfo();
        pi.Opacity = 100;
        fpSpread1.ActiveSheet.PrintInfo = pi;
    Copy Code
    Private Sub fpSpread1_PrintBackground(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.PrintBackgroundEventArgs) Handles FpSpread1.PrintBackground
        Dim pic As New FarPoint.Win.Picture(Image.FromFile("D:\Files\cover.jpg"), FarPoint.Win.RenderStyle.Normal)
        pic.AlignHorz = FarPoint.Win.HorizontalAlignment.Left
        pic.AlignVert = FarPoint.Win.VerticalAlignment.Top
        pic.Paint(e.Graphics, e.SheetRectangle)
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim pi As New FarPoint.Win.Spread.PrintInfo()
        pi.Opacity = 100
        fpSpread1.ActiveSheet.PrintInfo = pi
    End Sub
    See Also