Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
WinGrid ExtendLastColumn on print
posted

Hi,
iam trying to print a UltraGrid with the AutoFitStyle ExtendLastColumn.
But everytime the last Column gets small.

 

        private void ubtn_grid_print_Click(object sender, EventArgs e)
        {
            if (this.uDSLogEntries.Rows.Count > 0)
            {
                if (printDialog1.ShowDialog() == DialogResult.OK)
                {
                    printer = printDialog1.PrinterSettings;
                    Infragistics.Win.UltraWinGrid.UltraGridLayout layout = this.uGridLogs.DisplayLayout;
                    layout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ExtendLastColumn;
                    this.uGridLogs.Print(layout);
                }
            }
        }

 private void uGridLogs_InitializePrint(object sender, Infragistics.Win.UltraWinGrid.CancelablePrintEventArgs e)
        {
            e.PrintDocument.PrinterSettings = printer;
            e.PrintDocument.DefaultPageSettings.Landscape = true;
            e.PrintLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ExtendLastColumn;
        }

In the Grid on the Form everything looks good, but when i press the print button, the print output hast a small last column also on the Grid in the Form the last Column gets resized to small.

I hope someone can help me.

I use Infragistics2 v10.2

Thanks
Henning

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Henning,

    hmreimers said:
    the print output hast a small last column also on the Grid in the Form the last Column gets resized to small.

    I'm not sure what distinction you are making here. You seem to be saying the same thing twice. Do you mean that the width of the column in the grid on the screen is also changing width - in addition to the printed grid?

    If that's the case, then my guess is that something in your code is doing this. Maybe you are calling PerformAutoSize on some or all of the columns in the grid so that the data is all displayed in the printed grid? If that's the case, then you are probably calling the method on the wrong layout.

    When the grid is printed, a clone of the grid's DisplayLayout is created. The cloned layout is used for printing and will not affect the on-screen grid. So if your grid on-screen is changing when you print, then you must be changing the real DisplayLayout on the grid instead of the print layout.

Children
No Data