Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.4.6
|
Leadtools.Annotations.Core Namespace : IAnnAutomationControl Interface |
public interface IAnnAutomationControl
'Declaration
Public Interface IAnnAutomationControl
public interface IAnnAutomationControl
@protocol LTIAnnAutomationControl < NSObject >
public interface IAnnAutomationControl
function Leadtools.Annotations.Core.IAnnAutomationControl()
IAnnAutomationControl defines and interface that allows you to easily use any control you choose with LEADTOOLS Annotation Automation.
By default, the automation framework provides support for using a LEADTOOLS Leadtools.Controls.ImageViewer control as the surface where the automation is used. The source code for this implementation is in the Leadtools.Annotations.[Platform] example project shipped with your LEADTOOLS setup as described in the table below. LEADTOOLS_INSTALLATION_DIR
is the location of the LEADTOOLS SDK setup on your machine, usually at "C:\LEADTOOLS VersionNumber":
Platform | Project location |
---|---|
Windows Forms GDI+ (System.Drawing) |
C# version at Visual Basic version at |
WPF (PresentationCore) |
C# version at Visual Basic version at |
WinRT (Windows Store apps) |
C# version at Visual Basic version at |
JavaScript (HTML5) |
TypeScript version at For a pure JavaScript version, use the compiled code from the TypeScript version in |
iOS and OSX |
The implementation is inside the main annotations demo project at |
Android |
The implementation is inside the main annotations demo project at |
Each of these projects contain one or more implementation of IAnnAutomationControl with the class name ImageViewerAutomationControl
. The projects contain full source code that can be freely used and modified in your application.
To perform automation, the toolkit must interact with the control in different ways, for example, obtain information about the control size and resolution, subscribe to the various touch/mouse and keyboard events for user-interface integration, invalidate all or portions of the control surface for re-painting to draw the annotation objects and translate values between annotation and client coordinates.
When the above mode is used, you can use the ImageViewerAutomationControl
that implements IAnnAutomationControl and provides translation between the methods/properties/events of the interface and those of Leadtools.Controls.ImageViewer.
To instead use automation on your own custom control, you must create a class that implements IAnnAutomationControl and pass an instance of this class to AnnAutomation(AnnAutomationManager, IAnnAutomationControl) and optionally to attach and detach methods of AnnAutomation if more advanced functionality is required.
IAnnAutomationControl provides support for automating a single and multiple containers.
In single container mode, the autmation object has a single container to automate and all operations (including rendering) are performed on this container which is always the active one.
In multi-container mode, the automation object has multiple containers and each one of them can become active at any time (through user interaction by clicking on the container area in the control or through application code). The automation object will inform IAnnAutomationControl when the active container changes so the control can return the related information correctly.
Both mode work the same way and the IAnnAutomationControl implementation usually handles both cases in the same manner. The AutomationGetContainersCallback method is called by AnnAutomation to setup a callback that can be used by the control to obtain the collection of the current containers in the automation. AnnAutomation will always set AutomationContainerIndex property with the index of the container before requesting the information. For example, if the automation needs the transformation matrix for the 3rd container (at 0-based index of 2) in the list, it will first call AutomationContainerIndex with 3 before calling AutomationTransform. The implementer must save the last value of AutomationContainerIndex in a local variable and when the automation requests the information, it must use this value to obtain the transformation matrix. In the example of using a LEADTOOLS Leadtools.Controls.ImageViewer with multiple items, this will be the image transformation matrix of the 3rd item in the viewer.
Refer to the example source code for more information and a complete implementation.