Hi guys,
I have come across a problem when using the LabelPrinterLayer. Under certain circumstances, when resizing the LabelPrinterLayer you get a System.ArgumentException with the following stack trace:
System.ArgumentException was unhandled
Message=Value of '0' is not valid for 'emSize'. 'emSize' should be greater than 0 and less than or equal to System.Single.MaxValue.
Parameter name: emSize
Source=System.Drawing
ParamName=emSize
StackTrace:
at System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
at System.Drawing.Font.Initialize(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style)
at ThinkGeo.MapSuite.Core.GdiPlusGeoCanvas.Chg=(GeoFont DU8=)
at ThinkGeo.MapSuite.Core.GdiPlusGeoCanvas.MeasureTextCore(String text, GeoFont font)
at ThinkGeo.MapSuite.Core.GeoCanvas.MeasureText(String text, GeoFont font)
at ThinkGeo.MapSuite.Core.LabelPrinterLayer.ZkM=(GeoCanvas Z0M=, GeoFont aEM=, String aUM=, RectangleShape akM=)
at ThinkGeo.MapSuite.Core.LabelPrinterLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.DesktopEdition.PrinterInteractiveOverLay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.kBQ=(GeoCanvas kRQ=)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.NxQ=(RectangleShape FBg=, Overlay FRg=, Int32 Fhg=, Int32 Fxg=, GeographyUnit GBg=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.LBQ=(IEnumerable`1 Ghg=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.HBQ=()
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.GBQ=(Int32 CRg=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.BRQ=(InteractionArguments 9hc=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.8xM=(Object 6hc=, 4xU= 6xc=)
at QRQ=.5xQ=.OnMouseEvent(4xU= e)
at QRQ=.5xQ=.BBU=(Double BRU=, Double BhU=, Double BxU=, Double CBU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.8Bc=(Object 8Rc=, MouseEventArgs 8hc=)
at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at ScaleBarTest.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
We first noticed the problem when resizing the LabelPrinterLayer by dragging one of its corners with the mouse. At a certain point when the label became quite small the exception was thrown. As usual, I have attached a sample project for your convenience.
The MapSuite Desktop version that I am using is 5.5.0.68. Note that the attached project has the same name as an earlier one I sent and does not really reflect the LabelPrinterLayer problem.
Thanks!
Steve
001_PositionPrinterLayer.zip (35.5 KB)