# System.ArgumentException when resizing LabelPrinterLayer

**URL:** <https://community.thinkgeo.com/t/system-argumentexception-when-resizing-labelprinterlayer/1920>\
**Category:** WinForms\
**Created:** [March 6, 2012, 1:57pm UTC](https://community.thinkgeo.com/t/system-argumentexception-when-resizing-labelprinterlayer/1920 "2012-03-06T13:57:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven1](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/steven1/32/18983_2.png) [@Steven1](https://community.thinkgeo.com/u/Steven1)\
**Post date:** [March 6, 2012, 1:57pm UTC](https://community.thinkgeo.com/t/system-argumentexception-when-resizing-labelprinterlayer/1920/1 "2012-03-06T13:57:42Z")

</div>

Hi&nbsp;guys,

I&nbsp;have&nbsp;come&nbsp;across&nbsp;a&nbsp;problem&nbsp;when&nbsp;using&nbsp;the&nbsp;LabelPrinterLayer.&nbsp;Under&nbsp;certain&nbsp;circumstances,&nbsp;when&nbsp;resizing&nbsp;the&nbsp;LabelPrinterLayer&nbsp;you&nbsp;get&nbsp;a&nbsp;System.ArgumentException&nbsp;with&nbsp;the&nbsp;following&nbsp;stack&nbsp;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&nbsp;first&nbsp;noticed&nbsp;the&nbsp;problem&nbsp;when&nbsp;resizing&nbsp;the&nbsp;LabelPrinterLayer&nbsp;by&nbsp;dragging&nbsp;one&nbsp;of&nbsp;its&nbsp;corners&nbsp;with&nbsp;the&nbsp;mouse.&nbsp;At&nbsp;a&nbsp;certain&nbsp;point&nbsp;when&nbsp;the&nbsp;label&nbsp;became&nbsp;quite&nbsp;small&nbsp;the&nbsp;exception&nbsp;was&nbsp;thrown.&nbsp;As&nbsp;usual,&nbsp;I&nbsp;have&nbsp;attached&nbsp;a&nbsp;sample&nbsp;project&nbsp;for&nbsp;your&nbsp;convenience.

The&nbsp;MapSuite&nbsp;Desktop&nbsp;version&nbsp;that&nbsp;I&nbsp;am&nbsp;using&nbsp;is&nbsp;5.5.0.68.&nbsp;Note&nbsp;that&nbsp;the&nbsp;attached&nbsp;project&nbsp;has&nbsp;the&nbsp;same&nbsp;name&nbsp;as&nbsp;an&nbsp;earlier&nbsp;one&nbsp;I&nbsp;sent&nbsp;and&nbsp;does&nbsp;not&nbsp;really&nbsp;reflect&nbsp;the&nbsp;LabelPrinterLayer&nbsp;problem.

Thanks!

Steve

&nbsp;

[001\_PositionPrinterLayer.zip](https://community.thinkgeo.com/uploads/default/original/1X/89c9bb14c522f3ac1443748925b62f57e0ef2ceb.zip) (35.5 KB)

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [March 8, 2012, 10:00am UTC](https://community.thinkgeo.com/t/system-argumentexception-when-resizing-labelprinterlayer/1920/2 "2012-03-08T10:00:57Z")

</div>

Steven,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;have&nbsp;tested&nbsp;your&nbsp;sample&nbsp;by&nbsp;using&nbsp;&nbsp;DesktopEdition.dll&nbsp;and&nbsp;MapSuiteCore.dll&nbsp;which&nbsp;version&nbsp;is&nbsp;5.5.0.68,&nbsp;but&nbsp;I&nbsp;couldn’t&nbsp;reproduce&nbsp;the&nbsp;issue&nbsp;which&nbsp;you&nbsp;encountered.&nbsp;  
&nbsp;&nbsp;  
&nbsp;First,&nbsp;I&nbsp;click&nbsp;on&nbsp;the&nbsp;layer&nbsp;to&nbsp;make&nbsp;it&nbsp;to&nbsp;edit&nbsp;mode,&nbsp;and&nbsp;then&nbsp;drag&nbsp;the&nbsp;corner&nbsp;of&nbsp;layer&nbsp;boundary&nbsp;to&nbsp;make&nbsp;it&nbsp;smallest,&nbsp;but&nbsp;no&nbsp;exception&nbsp;thrown.&nbsp;  
&nbsp;&nbsp;  
&nbsp;If&nbsp;I&nbsp;misunderstand,&nbsp;please&nbsp;let&nbsp;me&nbsp;know&nbsp;and&nbsp;give&nbsp;me&nbsp;more&nbsp;information.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;James

---

<div class="post-metadata">

**Author:** ![Steven1](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/steven1/32/18983_2.png) [@Steven1](https://community.thinkgeo.com/u/Steven1)\
**Post date:** [March 8, 2012, 3:32pm UTC](https://community.thinkgeo.com/t/system-argumentexception-when-resizing-labelprinterlayer/1920/3 "2012-03-08T15:32:39Z")

</div>

Hi&nbsp;James,

Thanks&nbsp;for&nbsp;your&nbsp;reply.&nbsp;You&nbsp;say&nbsp;you&nbsp;clicked&nbsp;on&nbsp;the&nbsp;'layer'.&nbsp;Does&nbsp;that&nbsp;mean&nbsp;you&nbsp;clicked&nbsp;on&nbsp;the&nbsp;MapPrinterLayer&nbsp;or&nbsp;the&nbsp;LabelPrinterLayer?&nbsp;My&nbsp;problem&nbsp;is&nbsp;with&nbsp;the&nbsp;Label&nbsp;at&nbsp;the&nbsp;top&nbsp;of&nbsp;the&nbsp;print&nbsp;preview&nbsp;and&nbsp;the&nbsp;error&nbsp;occurs&nbsp;when&nbsp;it&nbsp;is&nbsp;resized,&nbsp;not&nbsp;the&nbsp;map.

Thanks,

Steve

&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [March 9, 2012, 12:17pm UTC](https://community.thinkgeo.com/t/system-argumentexception-when-resizing-labelprinterlayer/1920/4 "2012-03-09T12:17:58Z")

</div>

Steven,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thank&nbsp;you&nbsp;for&nbsp;reporting&nbsp;this&nbsp;bug.&nbsp;&nbsp;We&nbsp;were&nbsp;able&nbsp;to&nbsp;recreate&nbsp;the&nbsp;issue&nbsp;and&nbsp;it&nbsp;will&nbsp;be&nbsp;reviewed&nbsp;and&nbsp;assigned&nbsp;to&nbsp;our&nbsp;development&nbsp;team&nbsp;during&nbsp;the&nbsp;next&nbsp;week.&nbsp;&nbsp;Once&nbsp;the&nbsp;bug&nbsp;has&nbsp;been&nbsp;resolved&nbsp;I&nbsp;will&nbsp;update&nbsp;the&nbsp;ticket&nbsp;so&nbsp;that&nbsp;you&nbsp;will&nbsp;be&nbsp;aware&nbsp;of&nbsp;the&nbsp;resolution.&nbsp;&nbsp;If&nbsp;you&nbsp;ever&nbsp;need&nbsp;a&nbsp;status&nbsp;update,&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;add&nbsp;a&nbsp;comment&nbsp;to&nbsp;this&nbsp;ticket.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks!&nbsp;  
&nbsp;James&nbsp;

---

<div class="post-metadata">

**Author:** ![Gary2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/49beb7/32.png) [@Gary2](https://community.thinkgeo.com/u/Gary2)\
**Post date:** [March 22, 2012, 5:15pm UTC](https://community.thinkgeo.com/t/system-argumentexception-when-resizing-labelprinterlayer/1920/5 "2012-03-22T17:15:59Z")

</div>

Hello&nbsp;Steve,&nbsp;  
&nbsp;&nbsp;  
&nbsp;We&nbsp;have&nbsp;fixed&nbsp;this&nbsp;problem,&nbsp;you&nbsp;can&nbsp;get&nbsp;5.5.129.0&nbsp;or&nbsp;later&nbsp;and&nbsp;have&nbsp;a&nbsp;try.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know&nbsp;if&nbsp;you&nbsp;still&nbsp;meet&nbsp;the&nbsp;problem.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Gary

---

<div class="post-metadata">

**Author:** ![Steven1](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/steven1/32/18983_2.png) [@Steven1](https://community.thinkgeo.com/u/Steven1)\
**Post date:** [March 23, 2012, 5:50am UTC](https://community.thinkgeo.com/t/system-argumentexception-when-resizing-labelprinterlayer/1920/6 "2012-03-23T05:50:25Z")

</div>

Seems&nbsp;to&nbsp;be&nbsp;working&nbsp;fine&nbsp;now.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;guys.

---

<div class="post-metadata">

**Author:** ![Gary2](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/49beb7/32.png) [@Gary2](https://community.thinkgeo.com/u/Gary2)\
**Post date:** [March 23, 2012, 10:22am UTC](https://community.thinkgeo.com/t/system-argumentexception-when-resizing-labelprinterlayer/1920/7 "2012-03-23T10:22:15Z")

</div>

Hello&nbsp;Steven,&nbsp;  
&nbsp;&nbsp;  
&nbsp;You&nbsp;are&nbsp;welcome.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Gary
