Prior to version 14.5, annotations could be saved using the AnnCodecs.Save method in one of three formats:
- AnnCodecsFormat.Native - a text-based file format for storing annotations
- AnnCodecsFormat.Encoded - a binary file format for storing annotations
- AnnCodecsFormat.Serialize - a .NET Serialize format
There are many advantages of using the Xml format:
- Unlike the Native format, the Xml format is both forward- and backward-compatible.
- It is human readable.
- Files using the Xml format can be easily modified using a standard text editor (i.e. notepad.exe).
- Files using the Xml format can be easily parsed using any standard XML parser.
- Files using the Xml format can be used with any of the growing number of utilities that work with XML.
Non-automated Annotations Non-automated annotations allow you to customize the creation of and interaction with annotations to suit your own needs. When programming non-automated annotations, it is important to remember:
- You must provide any menus or dialogs you wish to use for entering annotation data.
- You must also provide your own means of drawing and interacting with the annotations.
- No hyperlink activation is provided for non-automated annotations. In addition to providing the code for entering hyperlink type and associated parameters, you must also provide the code for accessing the default web browser and calling any programs to be run through a hyperlink.
Automated Annotations
Automated annotations require an automation object to be associated with a RasterImageViewer. This automation object lets you maintain default properties for all objects. For example, you can use it to set the default font and the default line width. Keep in mind, however, that scaling factors affect the appearance of these default measurements. The values are set based on the scaling factors that are in effect at the time you create the object. Features associated with automated annotations are:
- Automated annotation menus that appear when you right-click in design mode.
- Automated drawing that lets you use the left mouse button to draw annotations in design mode.
- The annotation toolbar that lets you select the annotation tool to draw.
- Programmatical handling (by LEADTOOLS) of the activation of hyperlinks and audio annotations.
- The ability to undo/redo a number of user actions that were executed using the automated annotations functions.
- Use Rotate Control Points
- Use New Rubber Stamp Pictures
- Maintain Aspect Ratio
- Use New Group Edit Designer
- Use XP Style Toolbar
- Calibrate a ruler
Annotation Classes
The following paragraphs provide a brief introduction to the major classes that are used to implement support for annotations. The AnnAutomationObject class defines all the properties needed to automate an annotation object. You create an instance of this class and fill it up with the properties you want and then you add it to the Objects collection. At any time, you can enumerate the Objects collection and add or remove or modify any properties you want. The CreateDefaultObjects method creates the default AnnAutomationObject objects for the default annotation objects. LEADTOOLS will create the automation properties for the default annotation objects. You can change any property behavior by overriding members of this class or deriving your own. For information regarding default text strings used throughout the user interface in the automated mode, including information on how to override them, refer to Localization of LEADTOOLS for .NET Annotations Automation. Use the CreateDefaultObjects method to create the default automation annotation objects, and the CreateDefaultObjectContextMenu method to create the context menu associated with a certain id. You should call the CreateToolBar method after you finish setting up the automation objects in Objects or CreateDefaultObjects. After calling this method, a ToolBar is created and you can add it to your form. Use the FindObject method to find the AnnAutomationObject associated with a certain id. For a tutorial on creating user automation objects, refer to the Implement User-Defined Objects With LEADTOOLS Annotations. The AnnAutomationManager class holds the collection of all AnnAutomation objects in the application as well the annotation toolbar. Cursor, keyboard, context sensitive menus, property dialogs and various other user interface options and settings are stored here as well. An automated annotation application usually creates one AnnAutomationManager object per application. When working with annotations, the background color (the color that fills the interior) of many objects can be changed by changing the object's "brush", and line characteristics can be changed by changing the object's "pen". For more information, refer to Changing Annotation Automation Background Colors. Support for annotation brushes is provided by the AnnBrush and its derived classes, while support for annotation pens is provided by the AnnPen class. The AnnCodecs class handles loading and saving operations. The following methods let you load annotations from a file or save them to a file: The AnnContainer class represents an annotation container, a rectangular area that holds annotation objects. The container is responsible for maintaining these objects as well as drawing them upon request. The AnnDesigner class is the base class for all the designers in the annotation toolkit. An AnnDesigner derived class controls the user interface functionality involved in drawing, editing or running an object. This class provides the basic functionality common to all the designers such as hooking into a container, clipping the mouse cursor, etc. You assign an AnnContainer object to the Container member and a RasterImageViewer object to the Owner member of a designer. Then based on the exact designer functionality, it will hook into the various mouse events to draw a new, edit an existing (by moving, resizing, etc.) or run (if the container is in Run user mode) an AnnObject. The AnnDesigner classes provide the following methods as appropriate:- Cancel
- DoubleClick
- End
- EndClipCursor
- EndWorking
- GetLogicalAnnPoint
- HookContainer
- MouseDown
- MouseMove
- MouseUp
- Move
- MoveControlPoint
- MoveName
- OnAfterDrawingObjects
- OnDraw
- OnEdit
- OnRun
- Start
- StartClipCursor
- StartWorking
- Working
- CurrentObjectIdChanged event
- CurrentRubberStampTypeChanged event
- UserModeChanged event
- AfterObjectChanged event
- BeforeObjectChanged event
- CurrentDesignerChanged event
- ImageDirtyChanged event
- UndoRedoChanged event
- AfterDrawingObjects event
- BeforeDrawingObjects event
- Draw event
- Edit event
- Run event
- AnnAutomation.Copy method
- AnnAutomation.Delete method
- AnnAutomation.Paste method
- AnnAutomation.CanCopy property
- AnnAutomation.CanPaste property
- AnnAutomation.CurrentEditObject property
- AnnObject.UserData property
- AnnAutomation.ClipboardObjectFormat property
- AnnObject.SerializePassword property
- AnnAutomationManager.ContextMenu property
- AnnAutomationManager.ControlPointCursor property
- AnnAutomationManager.ControlPointsGap property
- AnnAutomationManager.ExtendedModeModifierKey property
- AnnAutomationManager.MultiSelectModifierKey property
- AnnAutomationManager.ObjectPropertiesDialogType property
- AnnAutomationManager.PasswordDialogType property
- AnnAutomationManager.RotateModifierKey property
- AnnAutomationManager.RubberStampButtonDropDownContextMenu property
- AnnAutomationManager.RunCursor Property
- AnnAutomationManager.SelectedObjectCursor property
- AnnAutomationManager.SelectObjectcursor property
- AnnAutomationManager.SelectRectangleCursor property
- AnnAutomationManager.ShowControlPoints property
- AnnAutomationManager.ToolBar property
- AnnAutomationManager.CreateDefaultObjectContextMenu method
- AnnAutomationManager.CreateDefaultObjects method
- AnnAutomationManager.CreateToolBar method
- AnnAutomationObject.ContextMenu property
- AnnAutomationObject.DrawCursor property
- AnnAutomationObject.DrawDesignerType property
- AnnAutomationObject.EditDesignerType property
- AnnAutomationObject.Id property
- AnnAutomationObject.Name property
- AnnAutomationObject.Object property
- AnnAutomationObject.RunDesignerType property
- AnnAutomationObject.ToolBarButton property
- AnnAutomationObject.ToolBarImage property
- AnnAutomationObject.ToolBarToolTipText property
- AnnAutomationManager.UseXPStyleToolBar property
- AnnAutomationObject.UseRotateControlPoints property
- AnnAutomationManager.MaintainAspectRatio property
- AnnNewGroupEditDesigner class
Topics