Hi guys,
Recently I did some work with the IconStyle to create highway numbers for road layers. Everthing worked as expected in the WinFormsMap. However, when I switched to our Page Layout map I began to get an Argument exception. Here is the stack trace:
System.ArgumentException was unhandled
Message=Parameter is not valid.
Source=System.Drawing
StackTrace:
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at ThinkGeo.MapSuite.Core.GeoCanvas.DrawScreenImageWithoutScaling(GeoImage image, Single centerXInScreen, Single centerYInScreen, DrawingLevel drawingLevel, Single xOffset, Single yOffset, Single rotateAngle)
at ThinkGeo.MapSuite.Core.GeoCanvas.DrawWorldImageWithoutScaling(GeoImage image, Double centerXInWorld, Double centerYInWorld, DrawingLevel drawingLevel, Single xOffset, Single yOffset, Single rotateAngle)
at ThinkGeo.MapSuite.Core.GeoCanvas.DrawWorldImageWithoutScaling(GeoImage image, Double centerXInWorld, Double centerYInWorld, DrawingLevel drawingLevel)
at ThinkGeo.MapSuite.Core.IconStyle.tRM=(GeoImage siQ=, Feature syQ=, GeoCanvas tCQ=, Int32 tSQ=, Int32 tiQ=, Collection`1 tyQ=, Collection`1 uCQ=)
at ThinkGeo.MapSuite.Core.IconStyle.DrawCore(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.ZoomLevel.DrawCore(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
at ThinkGeo.MapSuite.Core.ZoomLevel.Draw(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
at ThinkGeo.MapSuite.Core.FeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.MapPrinterLayer.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.ERQ=(InteractionArguments BBg=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.8xM=(Object 6hc=, 4xU= 6xc=)
at QRQ=.5xQ=.OnMouseEvent(4xU= e)
at QRQ=.5xQ=.DxU=(Double EBU=, Double ERU=, Double EhU=, Double ExU=, Int32 FBU=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.ARg=(Object Ahg=, MouseEventArgs Axg=)
at System.Windows.Forms.Control.OnMouseWheel(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseWheel(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()
I decided to put together a sample project to attach to this post. In preparing the project I noticed that if I set the IconImageScale property of the IconStyle to something other than 1 (the default) the IconStyle would draw and no longer produce the error. But even though setting the IconImageScale to something other than 1 causes the IconStyle to draw, it now draws outside of the boundaries of the MapPrinterLayer.
I have attached a sample project so you can easily see the problem.
Thanks!
Steve
001_Icon_Labels_In_Page_Layout.zip (184 KB)