Issue with AnnotationEditor using the ActiveX classes:
I have a picture viewer on one form.
The annotation Editor is started using a menu or button on this form.
It will create a second form, next to the viewer form. There the AnnotationEditor control is placed.
When closing this second screen and reopening it again I get an Error Message which is attached below:
Code: Select all
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Windows.Forms.UnsafeNativeMethods.IOleInPlaceFrame.SetBorderSpace(COMRECT pborderwidths)
at System.Windows.Forms.Control.ActiveXImpl.InPlaceActivate(Int32 verb)
at System.Windows.Forms.Control.ActiveXImpl.OnFocus(Boolean focus)
at System.Windows.Forms.Control.ChildGotFocus(Control child)
at System.Windows.Forms.Control.ChildGotFocus(Control child)
at System.Windows.Forms.Control.OnGotFocus(EventArgs e)
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnGotFocus(EventArgs e)
at System.Windows.Forms.Control.WmSetFocus(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4984 (win7RTMGDR.050727-4900)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
GdPicture.NET.10
Assembly Version: 10.0.0.7
Win32 Version: 10.0.0.7
CodeBase: file:///C:/Program%20Files%20(x86)/GdPicture.NET%2010/Redist/COM%20Interop/GdPicture.NET.10.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4986 (win7RTMGDR.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4985 (win7RTMGDR.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4985 (win7RTMGDR.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
This is what I do in pseudocode
Code: Select all
Form1.axGdViewer
Form2.axAnnotationEditor
On Create
Form1.axGdViewer.GetObject( GdObject )
axAnnotationEditor.LoadFromGdViewer( GdObject )
On Close
axAnnotationEditor.Dispose( )
an annotation in the viewer.
But when this Form2 is closed and opened again, I get the error message as given.
Seems the object is not really destroyed/cleaned up internally.
What am I missing here? I tried not disposing, I tried to LoadFromGDViewer with an empty object but did not help.
There is no issue when the AnnotationEditor is placed on Form1, along with the viewer. But in that case, the control is not destroyed but
is always present.
Any help is appreciated.