)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set the Watermark for the grid while printing in WinForms GridControl?

Platform: WinForms |
Control: GridControl |
Published Date: April 19, 2015 |
Last Revised Date: December 19, 2019

Watermark

There is no direct property to set the watermark in the Grid. The WaterMark image can be added to print documents by using the PrintPage event. With this event, you can draw images on the print document by using graphics. The following code example sets the background image for the Grid control and for drawing an image on printing a document.

C#

//Sets the interior style for the Grid control.
this.gridControl1.BaseStylesMap.Standard.StyleInfo.Interior = new Syncfusion.Drawing.BrushInfo(System.Drawing.Color.Transparent);
//Sets the background image for the Grid control.
this.gridControl1.BackgroundImage = Image.FromFile(@"..\..\images.jpg");
//Sets the image Layout. 
this.gridControl1.BackgroundImageLayout = ImageLayout.Stretch;
void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
    // Draws image while printing.
    e.Graphics.DrawImage(this.gridControl1.BackgroundImage, e.PageBounds);
}

 

VB

'Sets the interior style for the Grid control.
Me.gridControl1.BaseStylesMap.Standard.StyleInfo.Interior = New Syncfusion.Drawing.BrushInfo(System.Drawing.Color.Transparent)
‘Sets the background image for the Grid control.
Me.gridControl1.BackgroundImage = Image.FromFile("..\..\images.jpg")
'Sets the image Layout. 
Me.gridControl1.BackgroundImageLayout = ImageLayout.Stretch
void pd_PrintPage(Object sender, System.Drawing.Printing.PrintPageEventArgs e)
 ' Draws the image while printing.
 e.Graphics.DrawImage(Me.gridControl1.BackgroundImage, e.PageBounds)
End Sub

 

Watermark in the grid

Figure 1: Watermark in the Grid

Samples:

C#: WaterMarkImage_CS

VB: WaterMarkImage_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon