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 hide some columns and rows while printing in WinForms GridControl?

Platform: WinForms |
Control: GridControl

Hide some columns and rows

When you want to hide some columns and rows while printing, you can do so by handling the QueryColWidth and QueryRowHeight events and when the grid is in the PrintingMode, set the size property to zero by checking its index. The following code example show its implementation.


private void gridControl1_QueryRowHeight(object sender, Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs e)
      if(e.Index == 2 || e.Index == 3)
         e.Size = 0;
         e.Handled = true;


Private Sub gridControl1_QueryRowHeight(sender As Object, e As Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs) Handles gridControl1.QueryRowHeight
    If Me.gridControl1.PrintingMode Then
      If e.Index = 2 OrElse e.Index = 3 Then
        e.Size = 0
        e.Handled = True
      End If
    End If
End Sub


Reference link: https://help.syncfusion.com/windowsforms/grid-control/printing#printing-customizations

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
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