Hello,
In our product we use the UltraGrid. When doing a print preview, we get an OutOfRangeException.
Did anyone have seen this before and is there a workaround/solution available?
I checked the code in Infragistics.Win.UltraWinGridPrintManager.CalculateFirstRows.
There ut seems to be a situation of an endless loop when adding a new logical page. Somehow, for certain a certain amount of rows, it cannot determine what should be on the next logical page or it keep generating the same logical page.
I can reproduce this with one of the samples of NetAdvantage Select 2010, Vol. 1.
1. Goto Windows Forms -> Samples -> Grids -> Samples Explorer -> Print/Print Preview
2. Deselect Portrait
3. Delete first 30 rows.
4. Click on Preview
-> IndexOutOfRangeException
Service Release Version 0.1.2018
We're running on Windows7
Best regards,
Henk Wagterveld
Hi Henk,
I tried this out following the steps you listed here and it works just fine for me. Can you post the call stack of the exception?
Hi Mike,
It only happens the first time. First of all delete the rows. Did you printpreview as landscape?
Maybe play a bit with deleting the number of rows.
Here's the call stack
System.IndexOutOfRangeException: De index ligt buiten de matrixgrenzen. bij Infragistics.Win.UltraWinGrid.PrintManager.AddLogicalPrintPage(UltraGridRow row, Int32 scrollOffset) bij Infragistics.Win.UltraWinGrid.PrintManager.CalculateFirstRows() bij Infragistics.Win.UltraWinGrid.PrintManager.CalculatePageDimensions() bij Infragistics.Win.UltraWinGrid.PrintManager.BeginPrint(Object sender, PrintEventArgs e) bij Infragistics.Win.UltraWinGrid.UltraGridPrintDocument.OnBeginPrint(PrintEventArgs e) bij System.Drawing.Printing.PrintDocument._OnBeginPrint(PrintEventArgs e) bij System.Drawing.Printing.PrintController.Print(PrintDocument document) bij System.Drawing.Printing.PrintDocument.Print() bij Infragistics.Win.Printing.UltraPrintPreviewControl.GeneratePreviewHelper(Boolean synchronous) bij Infragistics.Win.Printing.UltraPrintPreviewControl.OnApplicationIdle(Object sender, EventArgs e) bij System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef) bij System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) bij System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) bij System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) bij System.Windows.Forms.Application.RunDialog(Form form) bij System.Windows.Forms.Form.ShowDialog(IWin32Window owner) bij SamplesExplorer.frmPrintDemo.cmdPrintPreview_Click(Object sender, EventArgs e) bij System.Windows.Forms.Control.OnClick(EventArgs e) bij System.Windows.Forms.Button.OnClick(EventArgs e) bij System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) bij System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) bij System.Windows.Forms.Control.WndProc(Message& m) bij System.Windows.Forms.ButtonBase.WndProc(Message& m) bij System.Windows.Forms.Button.WndProc(Message& m) bij System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bij System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bij System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
.
I used 10.1, since that's what you said you were using in your initial post. But I am using the latest internal build so it's possible that I have some fixes that you don't.
I believe that the 20101.2027 service release is now available. So perhaps you should try that and see if you still have the problem.
I did some more testing and found out that this occurs when maximaxing the grid application to its maximum size (in my case I use a screenresolution 1900 x 1200. However, I could also reproduce it for 1280x1024.
When I keep the test application to its initial size, then the error doesn't come.
I tried both 32- and 64-bit, but see the same behaviour. Also the printerchoice doesn't help.
I installed the latest service release, but that didn't help either.
Can you test with these resolutions and resize your application to maximum size?
Regards, Henk
Okay, that was the key. When I maximized the form, I get the exception. I will forward this thread over to Infragistics Developer Support so they can get this fixed.
As this is the same issue you reported in your support case, a development issue has already been created for you with an issue ID of 32895.
Issue "32895: Print preview gives an OutOfRangeException" has been addressed in service release versions 10.1.20101.2033 CLR 2.0, 10.2.20102.2003 CLR 2.0.