Hi guys!
I'm hoping I can put this across in a way that is meaningful and clear to you, but please let me know otherwise.
We are writing a document management system which uses a custom, bespoke viewer to allow the display of images and other document files (such as office documents, PDFs etc). The annotation features are enabled by an AnnotationController component say on the main viewer form. So far we have successfully implemented loading, saving and display routines which are based on the code from an older version of our program, mainly for backwards compatibility.
I have recently started work on the user-annotation interaction side of the project, which includes functionality such as creating new annotations and amending existing ones. The main problem we have at the moment is that if we drop the Annotation Controller into the Author interaction mode, we get an exception when we click an annotation to select it. The basic exception message is:
Value was either too large or too small for an Int32
The full detail of the exception is as follows:
1. Exception Information
===============================
Exception Type: System.OverflowException
Message: Value was either too large or too small for an Int32.
Data: System.Collections.ListDictionaryInternal
TargetSite: Int32 ToInt32(Double)
HelpLink: NULL
Source: mscorlib
StackTrace Information
===============================
at System.Convert.ToInt32(Double value)
at Atalasoft.Annotate.Renderer.AnnotationRenderingEngine.RenderGrips(IAnnotationGrips grips, AnnotationData annotation, RenderEnvironment e, PointF scale)
at Atalasoft.Annotate.Renderer.AnnotationRenderingEngine.RenderGrips(IAnnotationGrips grips, AnnotationData annotation, RenderEnvironment e)
at Atalasoft.Annotate.UI.AnnotationController.OnPaint(PaintEventArgs e)
at Atalasoft.Annotate.UI.AnnotationController.a(Object A_0, PaintEventArgs A_1)
at System.Windows.Forms.PaintEventHandler.Invoke(Object sender, PaintEventArgs e)
at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
From our investigations we are almost certain that the IAnnotate interface class is to blame; more especially the 'Transform()' property on this interface. As things stand at the moment we are passing an empty matrix object back through this property as we didn't think we needed anything else unless we were physically changing the annotation. It would seem that we were wrong.
Could you give us any clues about what we should be returning through the Transform property in order to simply get an annotation to select itself and fire the Click event on the annotation controller? We don't currently have any other transform properties that we can clone or reflect, so my assumption is that we will have to build and populate a matrix object from a collection of other properties.
Any assistance or clues would be much appreciated.
Thanks.