Hi ,
If we define a style to represent a point as :
new PointStyle(new WpfGeoImage(new Uri(“pack://application:,/Test.UI;component/Images/Icon3.png”)));
and the icon3.jpg is defined as a resource, there is an error message :
L’exception System.ArgumentException n’a pas été gérée
HResult=-2147024809
Message=Image from image path: is missing or invalid.
Source=WpfDesktopEdition
StackTrace:
à ThinkGeo.MapSuite.WpfDesktopEdition.Tile.<>c__DisplayClass6.<DrawException>b__4()
à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
à System.Windows.Threading.DispatcherOperation.InvokeImpl()
à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Windows.Threading.DispatcherOperation.Invoke()
à System.Windows.Threading.Dispatcher.ProcessQueue()
à System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
à System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
à MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
à System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
à System.Windows.Application.RunInternal(Window window)
à System.Windows.Application.Run()
à Test.Tests.App.Main() dans C:\Steph_MainTFS\Main\Test.Tests\obj\x86\Debug\App.g.cs:ligne 51
à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()
InnerException:
The version dll used is 8.0.103.0.
Can you reproduce this error message ?
Are we making a mistake when we define the style of the point with wpfgeoimage ?
Thanks for your help.
Regards.
Steph.
Error message with wpfgeoimage to set the style of a point
Hi Steph,
From the description of exception, seems like there should
be something with the image path or the WpfGeoImage, I guess it’s hard for us
to determine the problem just based on it, would you please attach the code of
WpfGeoImage here? Or please send it to forumsupport@thinkgeo.com?
Thanks,
Johnny
HI Johnny,
I joined an example with WpfGeoImage.
The version of dll is 8.0.103.0.
- The zip file is the project
- The screenshot is to see the project organization.
Thanks for your help.
Regards.
Steph.
WPFThinkgeo_Test1.zip (3.05 KB)
002_ScreenSHot.jpg (7.31 KB)
Hi Steph,
Thanks for your demo, the WpfGeoImages is used with WpfGeoCanvas and DrawingVisualGeoCanvas for EditInteractiveOverlay and TrackInteractiveOverlay, but PointStyle uses GDI+ for drawing, please try the code as following:
m.ZoomLevelSet.ZoomLevel01.DefaultPointStyle
= new PointStyle(new GeoImage("…/…/icon3.png"));
Thanks,
Johnny
Hi Johnny,
I tested WpfGeoimage because it was possible to use a uri, which is not the case with GeOimage.
Thanks.
Regards.
Steph.
Hi Steph,
Like Johnny mentioned the reason, we can’t specify the WpfGeoImage as GeoImage, as for the Uri, I think there is another way to get geoimage from an uri:
private GeoImage GetGeoImage(Uri imageUri)
{
// return new GeoImage(Application.GetRemoteStream(imageUri).Stream);
return new GeoImage(Application.GetContentStream(imageUri).Stream);
}
Hope it helps.
Thanks,
Troy