Articles in this section
Category / Section

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

1 min read

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

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied