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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the print preview dialog in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl
Tags: printing

Customize the print preview dialog

Print preview dialog can be customized by creating a new form like print preview dialog window. In the code sample, the print document GridPrintDoc has been derived from GridPrintDocumentAdv and drawing of the grid will be performed using DrawGrid method.


rectToPrintGrid = new Rectangle(eventArgs.MarginBounds.Left, intOffset, intGridWidth, intGridHeight);
//draw the grid in print preview pages
_grid.DrawGrid(eventArgs.Graphics, rectToPrintGrid, false, false);
private void PrintPreview_Click(object sender, EventArgs e)
        //GridPrintDoc is derived from the Syncfusion.GridHelperClasses.GridPrintDocumentAdv 
        GridPrintDoc pd = new GridPrintDoc(this.gridGroupingControl1.TableControl);
        frm = new PreviewDialog(this.gridGroupingControl1); //PreviewDialog is derived from the Form
        frm.document = pd;
        if (frm.PageSetting == null)
    catch (Exception ex)
        MessageBox.Show("Error while print preview" + ex.ToString());



rectToPrintGrid = New Rectangle(eventArgs.MarginBounds.Left, intOffset, intGridWidth, intGridHeight)
'draw the grid in print preview pages
_grid.DrawGrid(eventArgs.Graphics, rectToPrintGrid, False, False)
Private Sub PrintPreview_Click(ByVal sender As Object, ByVal e As EventArgs) Handles PrintPreview.Click
        'GridPrintDoc is derived from the Syncfusion.GridHelperClasses.GridPrintDocumentAdv
        Dim pd As GridPrintDoc = Nothing
        pd = New GridPrintDoc(Me.gridGroupingControl1.TableControl)
        'PreviewDialog is derived from the Form
        frm = New PreviewDialog(Me.gridGroupingControl1)
        frm.grouping_grid = Me.gridGroupingControl1
        frm.document = pd
        If frm.PageSetting Is Nothing Then
        End If
    Catch ex As Exception
            MessageBox.Show("Error while print preview" & ex.ToString())
    End Try
End Sub



Customize the print preview dialog


C#: Print Preview

VB: Print Preview

Reference link: https://help.syncfusion.com/windowsforms/classic/gridgroupingcontrol/printing

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment
Mukesh Rebari
Aug 08, 2016
sir give me one more day to resolve this issues

Neelakandan Kannan [Syncfusion]
Aug 08, 2016
Hi Mukesh,

Can you please let us know what kind of issue that you are having in Print Preview?


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