Issue with 500% zoom? RRS feed

  • Question

  • Hi all,

    I am working on a windows forms app developed in VS 2008 which has a reference to the ReportViewer control version When a report is displayed with the control we get an error whenever a zoom level of 500% is set whether by using the drop down or mouse scroll.

    The error message is


    Unhandled exception has occurred in your application. If you Click continue, the application will ignore this error and attempt to continue. If you click Quit, the application close immediately.

    The operation completed successfully.

    Details Button - Continue Button - Quit Button


    If I press Continue the same message is re-displayed and Quit closes the application.

    If I press Details I get a long list of Exception Text thus


    ************** Exception Text **************
    System.ComponentModel.Win32Exception: The operation completed successfully
       at System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits)
       at System.Drawing.BufferedGraphicsContext.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height)
       at System.Drawing.BufferedGraphicsContext.AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
       at System.Drawing.BufferedGraphicsContext.AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
       at System.Drawing.BufferedGraphicsContext.Allocate(IntPtr targetDC, Rectangle targetRectangle)
       at System.Windows.Forms.Control.WmPaint(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    To me it seems as if it's a bug with the ReportViewer control or may be our code has not instantiated it correctly.

    Any help is greatly appreciated. BTW I'm running the app on a Win XP Pro SP3 box if that makes any difference,

    Cheers John


    Thursday, October 28, 2010 10:37 PM

All replies

  • This is a known issue with the viewer when viewing a large report (in terms of the actual width and height of the report, not the contents or data associated with it).  It happens when the viewer runs out of memory trying to display the zoomed report all at once.  The best way to avoid it is to use a smaller page size or to not zoom to the highest levels when viewing large pages.
    Friday, October 29, 2010 3:16 AM
  • Hi Brian,

    Thanks for your reply. Is there no way to trap this in the code, either by preventing certain zoom options, or catch it in an event??

    Cheers John

    Tuesday, November 9, 2010 3:09 AM
  • Hi Brian,

    Just found the OnZoomChanged event, which allows us to trap a user setting it to 500%. However is there any way we can remove the 500% entry from the drop down?

    Cheers John

    Tuesday, November 9, 2010 5:45 AM
  • There is no way to remove an entry from the dropdown.  But you can hide the entire dropdown using the ShowZoomControl property.  You could then control the zoom manually with the ZoomMode and ZoomPercent properties.
    Monday, November 15, 2010 3:32 AM
  • Is there a way to catch this exception when it does occur?
    Friday, December 3, 2010 3:13 PM
  • Bump - Is there a way to catch this exception?  I've had several users report this problem.

    I resorted to using the ZoomChange event, check if a 500% zoom selected, and if so, warn the user that they may encounter a problem displaying the report.  If they choose to proceed, it is at their own risk.  Not an ideal solution, but workable until Microsoft fixes the underlying problem.

    Tuesday, December 21, 2010 5:00 PM
  • All,

    I ran over the same error message, but not in a Report Viewer.  I created a control that when doube clicked is horizontally zoomed in 1,2,3,4, etc. times upon each double click.

    The control is on a form within a panel control, so the control, which is a picturebox, will expand horizontally at a scale factor i define.  With that said, when I am at a full screen size with the form, which on my screen my screen size is  a 28" inch screen with a screen resolution of 1920 by 1200, and I zoom in horizontally about 5 times original size of control, i received the same error message.

    I looked at the Target Site of the error in the debugger and believe i tracked it back to a ReflectedType of BufferedGraphicsContext.  The error message actually said Not enough memory is available to process this command"

    It is here where i believe the issue lies.  I think the Maximum memory Buffer Size for rendering graphics is actually exceeded, therefore causing this problem.  I therefore believe this issue is a framework wide issue.  There is a limitation with buffered graphics in memory and the original maximum buffer size in pixels is (225,96). 

    Any other suggestions!



    Friday, February 18, 2011 2:47 PM
  • All,

    Update to previous post.  I came acorss this website dealing with an issue similiar to the error message you received.

    It suggested changing the color depth setting of your screen from 32 bit to 16 bit.

    I followed the suggestion and it did work!  However, this does not solve the problem because we need to be able to distribute applications without worrying about the color depth setting of the client computer.  This is a good temporary fix, it may or may not work for you, but it may explain some things based on the 32 bit or 16 bit limitations.



    Friday, February 18, 2011 3:31 PM