←Select platform

IAnnAutomationControl Interface


Support for user controls with the LEADTOOLS Annotation Automation.

public interface IAnnAutomationControl 
Public Interface IAnnAutomationControl  
@protocol LTIAnnAutomationControl <NSObject> 
public interface IAnnAutomationControl 
   interface class IAnnAutomationControl abstract 


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 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. <installdir> 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 <installdir>\Examples\DotNet\CS\Leadtools.Annotations.Winforms
C# version at <installdir>\Examples\DotNet\CS\AnnotationsDemo

VB version at <installdir>\Examples\DotNet\VB\AnnotationsDemo

WPF (PresentationCore)

C# version at <installdir>\Examples\DotNet3\CS\Leadtools.Annotations.Wpf

JavaScript (HTML5)

JS version at <installdir>\Examples\JS\Documents\Demos\WebApp\Apps\Annotations
JS version at <installdir>\Examples\JS\Leadtools.Annotations.JavaScript

For a pure JavaScript version, use the compiled code from the TypeScript version in <installdir>\Examples\JS\Common\Libs\Leadtools.Annotations.JavaScript.js

iOS and macOS

version at <installdir>\Examples\Xcode\[iOS\macOS]\AnnotationsDemo


Android version at <installdir>\Examples\Android\AnnotationsDemo

Each of these projects contains one or more implementations 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. This includes the following tasks:

  • Obtain information about the control's 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
  • 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 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.

The IAnnAutomationControl provides support for automating a single or multiple containers.

In single container mode, the automation 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. Each container 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 related information correctly.

Both modes work the same way and the IAnnAutomationControl implementation usually handles both cases in the same manner. The AutomationGetContainersCallback method is called by AnnAutomation to set up 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 the 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 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.


Target Platforms

Help Version 20.0.2019.3.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.Engine Assembly