Perform the following steps to create and run a program that implements Automated Annotations:
In the "Solution Explorer" window, right-click the "References" folder, and choose "Add Reference…" from the context menu. In the "Add Reference" dialog box, select the ".NET" tab and browse to the "<LEADTOOLS_INSTALLDIR>\Bin\DotNet4\Win32 " folder and select the following DLLs:
Click Add and then click OK to add the above DLLs to the application.
Switch to Form1 code view (right-click Form1 in the Solution Explorer and then choose View Code) and add the following lines at the beginning of the file:
Imports LeadtoolsImports Leadtools.Annotations.CoreImports Leadtools.Annotations.DesignersImports Leadtools.Annotations.AutomationImports Leadtools.CodecsImports Leadtools.ControlsImports Leadtools.Annotations.WinForms
using Leadtools;using Leadtools.Annotations.Core;using Leadtools.Annotations.Designers;using Leadtools.Annotations.Automation;using Leadtools.Codecs;using Leadtools.Controls;using Leadtools.Annotations.WinForms;
Declare the following private variables:
Private automationControl As ImageViewerAutomationControlPrivate viewer As ImageViewer' The Automation Manager is used to manage the automation mode.Private annAutomationManager As AnnAutomationManagerPrivate WithEvents automation As AnnAutomation
private ImageViewer viewer;private ImageViewerAutomationControl automationControl;// The Automation Manager is used to manage the automation mode.private AnnAutomationManager annAutomationManager;private AnnAutomation automation;
Add an event handler to the Form1 Load event and code it as follows:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Loadviewer = New ImageViewer()viewer.Dock = DockStyle.FillautomationControl = New ImageViewerAutomationControl()automationControl.ImageViewer = viewer' initialize a new RasterCodecs objectDim codecs As New RasterCodecs()' load the main image into the viewerviewer.Image = codecs.Load("C:\Users\Public\Documents\LEADTOOLS Images\Sample1.cmp")'initialize the interactive mode for the viewerDim automationInteractiveMode As AutomationInteractiveMode = New AutomationInteractiveMode()automationInteractiveMode.AutomationControl = automationControl'add the interactive mode to the viewerviewer.InteractiveModes.BeginUpdate()viewer.InteractiveModes.Add(automationInteractiveMode)viewer.InteractiveModes.EndUpdate()If(Not IsNothing(viewer.Image)) Then' create and set up the automation managerannAutomationManager = New AnnAutomationManagerannAutomationManager.RestrictDesigners = True' Instruct the manager to create all of the default automation objects.annAutomationManager.CreateDefaultObjects()Dim managerHelper As AutomationManagerHelper = New AutomationManagerHelper(annAutomationManager)managerHelper.CreateToolBar()Controls.Add(managerHelper.ToolBar)Controls.Add(viewer)' set up the automation (it will create the container as well)automation = New AnnAutomation(annAutomationManager, automationControl)' set this automation as the active oneautomation.Active = Trueautomation.Container.Size = automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(viewer.Image.ImageWidth, viewer.Image.ImageHeight))End IfEnd Sub
private void Form1_Load(object sender, System.EventArgs e){viewer = new ImageViewer();viewer.Dock = DockStyle.Fill;automationControl = new ImageViewerAutomationControl();automationControl.ImageViewer = viewer;// initialize a new RasterCodecs objectRasterCodecs codecs = new RasterCodecs();// load the main image into the viewerviewer.Image = codecs.Load(@"C:\Users\Public\Documents\LEADTOOLS Images\Sample1.cmp");// initialize the interactive mode for the viewerAutomationInteractiveMode automationInteractiveMode = new AutomationInteractiveMode();automationInteractiveMode.AutomationControl = automationControl;// add the interactive mode to the viewerviewer.InteractiveModes.BeginUpdate();viewer.InteractiveModes.Add(automationInteractiveMode);viewer.InteractiveModes.EndUpdate();if (viewer.Image != null){// create and set up the automation managerannAutomationManager = new AnnAutomationManager();annAutomationManager.RestrictDesigners = true;// Instruct the manager to create all of the default automation objects.annAutomationManager.CreateDefaultObjects();// initialize the manager helper and create the toolbar and add it then the viewer to the controlsAutomationManagerHelper managerHelper = new AutomationManagerHelper(annAutomationManager);managerHelper.CreateToolBar();Controls.Add(managerHelper.ToolBar);Controls.Add(viewer);// set up the automation (it will create the container as well)automation = new AnnAutomation(annAutomationManager, automationControl);// set this automation as the active oneautomation.Active = true;//set the size of the container to the size of the viewerautomation.Container.Size = automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(viewer.Image.ImageWidth, viewer.Image.ImageHeight));}}
|
Products |
Support |
Feedback: Working with Automated Annotations |
Introduction |
Help Version 19.0.2017.6.21
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.