We use the Desktop Edition winformsMap1 control to display the maps from the World Map Data Kit. Our application is an old-fashioned MDI forms using C# Forms (not using WPF yet). We have the ability to dock and undocked the tab control tab where the winformsMap1 is defined. If we minimize the MDI child form containing winformsMap1 and then close that form while it is still minimized, we get an exception which looks like it is originating from Winforms code in MapSuite. Here is a partial stack trace from the exception:
[10] 2012-06-04 07:44:16,685 ERROR STTI.FAC.TestBed.Gui.Program Error encountered constructing TestBedGui. Exception: System.ArgumentException: Value of '{Width=2, Height=-20}' is not valid for 'MaximumBuffer'.
at System.Drawing.BufferedGraphicsContext.set_MaximumBuffer(Size value)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.qBc=(Object qRc=, EventArgs qhc=)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
I will attach the entire stack trace to this topic if anyone cares to see it. Originally this exception was not being caught in our application and it caused our application to crash. I have inserted a try-catch in the closest reference in our code which is nearly half-way down in the lengthy attached stack trace and it successfully prevents the application from crashing.
However, I am wondering if anyone else has encountered a similar exception and if there is a better way to prevent it than just using the try-catch and ignoring it. Is there a way to handle disposing of the winformsMap1 when it is closed while the containing form is minimized?
Thanks for any help with this.
Richard