Manages the automation mode for an annotation application.
public class AnnAutomationManagerPublic Class AnnAutomationManagerpublic ref class AnnAutomationManagerThe 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.
This example creates an automated annotation application. This example will only use the line and rectangle objects. The example lets you select objects from the toolbar, draw objects on top of the image, select objects and move them or change them, right click on any object to show its properties, etc.
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPrivate Class MyWindow1 : Inherits WindowPrivate manager As AnnAutomationManagerPrivate viewer As ImageViewerPublic Sub New(ByVal title As String)Me.Title = titleMe.Width = 400Me.Height = 400viewer = New ImageViewer()' load an image into the viewer' fix this path to an existing image file on your systemviewer.Source = New BitmapImage(New Uri(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg")))viewer.Width = Double.NaNviewer.Height = Double.NaN' create and set up the automation managermanager = New AnnAutomationManager()' Create only the line and rectangle automation objectsCreateMyAutomationObjects(manager)' You can instruct the manager to create the default (all) automation objects.' comment out the call to CreateMyAutomationObjects and call this instead:'theManager.CreateDefaultObjects();' create the toolbar and add it to the ToolBarTraymanager.CreateToolBar()Dim tbt As ToolBarTray = New ToolBarTray()tbt.Orientation = Orientation.HorizontalDockPanel.SetDock(tbt, Dock.Top)tbt.ToolBars.Add(manager.ToolBar.ToolBar)Dim dp As DockPanel = New DockPanel()dp.Children.Add(tbt)dp.Children.Add(viewer)' set the DockPanel as a content of the window.Me.Content = dp' set up the automation (will create the container as well)Dim automation As AnnAutomation = New AnnAutomation(manager, viewer)' set up this automation as the active oneautomation.Active = Trueautomation.UndoCapacity = 12End SubPrivate Sub CreateMyAutomationObjects(ByVal manager As AnnAutomationManager)' set up the select automation objectDim selObj As AnnAutomationObject = New AnnAutomationObject()selObj.Id = AnnAutomationManager.SelectObjectIdselObj.Name = "Select"selObj.Object = NothingselObj.DrawDesignerType = GetType(AnnRectangleDrawDesigner)selObj.EditDesignerType = NothingselObj.RunDesignerType = Nothing' create the toolbar button (or you can load the image from a disk file or resource)Dim dv As DrawingVisual = New DrawingVisual()Using dc As DrawingContext = dv.RenderOpen()dc.DrawRectangle(New SolidColorBrush(Color.FromRgb(236, 233, 216)), Nothing, New Rect(0, 0, 24, 24))dc.DrawLine(New Pen(Brushes.Black, 2), New System.Windows.Point(4, 4), New System.Windows.Point(22, 22))dc.DrawLine(New Pen(Brushes.Black, 2), New System.Windows.Point(4, 22), New System.Windows.Point(22, 4))dc.Close()Dim bmp As RenderTargetBitmap = New RenderTargetBitmap(24, 24, 96, 96, PixelFormats.Pbgra32)bmp.Render(dv)selObj.ToolBarButtonImage = bmpEnd UsingselObj.ToolBarButtonToolTip = New ToolTip()selObj.ToolBarButtonToolTip.Content = "Select"selObj.DrawCursor = Cursors.HandselObj.ContextMenu = NothingDim selectObj As AnnSelectObject = New AnnSelectObject()selectObj.Stroke = Colors.WhiteselectObj.StrokeThickness = 2.0selObj.Object = selectObjmanager.Objects.Add(selObj)' set up the line automation objectDim lineObj As AnnAutomationObject = New AnnAutomationObject()lineObj.Id = AnnAutomationManager.LineObjectIdlineObj.Name = "Line"Dim line As AnnLineObject = New AnnLineObject()line.Stroke = Colors.Redline.StrokeThickness = 2.0lineObj.Object = linelineObj.DrawDesignerType = GetType(AnnLineDrawDesigner)lineObj.EditDesignerType = GetType(AnnLineEditDesigner)lineObj.RunDesignerType = GetType(AnnRunDesigner)Using dc As DrawingContext = dv.RenderOpen()dc.DrawRectangle(New SolidColorBrush(Color.FromRgb(236, 233, 216)), Nothing, New Rect(0, 0, 24, 24))dc.DrawLine(New Pen(Brushes.Black, 2), New System.Windows.Point(4, 4), New System.Windows.Point(22, 22))dc.Close()Dim bmp As RenderTargetBitmap = New RenderTargetBitmap(24, 24, 96, 96, PixelFormats.Pbgra32)bmp.Render(dv)lineObj.ToolBarButtonImage = bmpEnd UsinglineObj.ToolBarButtonToolTip = New ToolTip()lineObj.ToolBarButtonToolTip.Content = "Draw new line object"lineObj.DrawCursor = Cursors.CrosslineObj.ContextMenu = AnnAutomationManager.CreateDefaultObjectContextMenu(lineObj.Id)manager.Objects.Add(lineObj)' set up the rectangle automation objectDim rectObj As AnnAutomationObject = New AnnAutomationObject()rectObj.Id = AnnAutomationManager.RectangleObjectIdrectObj.Name = "Rectangle"Dim rect As AnnRectangleObject = New AnnRectangleObject()rect.Stroke = Colors.Redrect.StrokeThickness = 2.0rect.Fill = Colors.WhiterectObj.Object = rectrectObj.DrawDesignerType = GetType(AnnRectangleDrawDesigner)rectObj.EditDesignerType = GetType(AnnRectangleEditDesigner)rectObj.RunDesignerType = GetType(AnnRunDesigner)Using dc As DrawingContext = dv.RenderOpen()dc.DrawRectangle(New SolidColorBrush(Color.FromRgb(236, 233, 216)), Nothing, New Rect(0, 0, 24, 24))dc.DrawRectangle(Nothing, New Pen(Brushes.Black, 2), New Rect(2, 4, 20, 18))dc.Close()Dim bmp As RenderTargetBitmap = New RenderTargetBitmap(24, 24, 96, 96, PixelFormats.Pbgra32)bmp.Render(dv)rectObj.ToolBarButtonImage = bmpEnd UsingrectObj.ToolBarButtonToolTip = New ToolTip()rectObj.ToolBarButtonToolTip.Content = "Draw new rectangle object"rectObj.DrawCursor = Cursors.CrossrectObj.ContextMenu = AnnAutomationManager.CreateDefaultObjectContextMenu(rectObj.Id)manager.Objects.Add(rectObj)' set up the group automation object (always needed)Dim groupObj As AnnAutomationObject = New AnnAutomationObject()groupObj.Id = AnnAutomationManager.GroupObjectIdgroupObj.Name = "Group"groupObj.Object = New AnnGroupObject()groupObj.DrawDesignerType = NothinggroupObj.EditDesignerType = GetType(AnnGroupEditDesigner)groupObj.RunDesignerType = GetType(AnnRunDesigner)groupObj.ToolBarButtonImage = Nothing ' group is not in the toolbargroupObj.ToolBarButtonToolTip = NothinggroupObj.DrawCursor = NothinggroupObj.ContextMenu = AnnAutomationManager.CreateDefaultObjectContextMenu(groupObj.Id)manager.Objects.Add(groupObj)End SubEnd ClassPrivate Sub AnnAutomationManager_AnnAutomationManager(ByVal title As String)Dim window As MyWindow1 = New MyWindow1(title)window.ShowDialog()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Demos;using Leadtools.Help;private class MyWindow1 : Window{AnnAutomationManager manager;ImageViewer viewer;public MyWindow1(string title){this.Title = title;this.Width = 400;this.Height = 400;viewer = new ImageViewer();// load an image into the viewer// fix this path to an existing image file on your systemviewer.Source = new BitmapImage(new Uri(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg")));viewer.Width = double.NaN;viewer.Height = double.NaN;// create and set up the automation managermanager = new AnnAutomationManager();// Create only the line and rectangle automation objectsCreateMyAutomationObjects(manager);// You can instruct the manager to create the default (all) automation objects.// comment out the call to CreateMyAutomationObjects and call this instead://theManager.CreateDefaultObjects();// create the toolbar and add it to the ToolBarTraymanager.CreateToolBar();ToolBarTray tbt = new ToolBarTray();tbt.Orientation = Orientation.Horizontal;DockPanel.SetDock(tbt, Dock.Top);tbt.ToolBars.Add(manager.ToolBar.ToolBar);DockPanel dp = new DockPanel();dp.Children.Add(tbt);dp.Children.Add(viewer);// set the DockPanel as a content of the window.this.Content = dp;// set up the automation (will create the container as well)AnnAutomation automation = new AnnAutomation(manager, viewer);// set up this automation as the active oneautomation.Active = true;automation.UndoCapacity = 12;}private void CreateMyAutomationObjects(AnnAutomationManager manager){// set up the select automation objectAnnAutomationObject selObj = new AnnAutomationObject();selObj.Id = AnnAutomationManager.SelectObjectId;selObj.Name = "Select";selObj.Object = null;selObj.DrawDesignerType = typeof(AnnRectangleDrawDesigner);selObj.EditDesignerType = null;selObj.RunDesignerType = null;// create the toolbar button (or you can load the image from a disk file or resource)DrawingVisual dv = new DrawingVisual();using(DrawingContext dc = dv.RenderOpen()){dc.DrawRectangle(new SolidColorBrush(Color.FromRgb(236, 233, 216)), null, new Rect(0, 0, 24, 24));dc.DrawLine(new Pen(Brushes.Black, 2), new Point(4, 4), new Point(22, 22));dc.DrawLine(new Pen(Brushes.Black, 2), new Point(4, 22), new Point(22, 4));dc.Close();RenderTargetBitmap bmp = new RenderTargetBitmap(24, 24, 96, 96, PixelFormats.Pbgra32);bmp.Render(dv);selObj.ToolBarButtonImage = bmp;}selObj.ToolBarButtonToolTip = new ToolTip();selObj.ToolBarButtonToolTip.Content = "Select";selObj.DrawCursor = Cursors.Hand;selObj.ContextMenu = null;AnnSelectObject selectObj = new AnnSelectObject();selectObj.Stroke = Colors.White;selectObj.StrokeThickness = 2.0;selObj.Object = selectObj;manager.Objects.Add(selObj);// set up the line automation objectAnnAutomationObject lineObj = new AnnAutomationObject();lineObj.Id = AnnAutomationManager.LineObjectId;lineObj.Name = "Line";AnnLineObject line = new AnnLineObject();line.Stroke = Colors.Red;line.StrokeThickness = 2.0;lineObj.Object = line;lineObj.DrawDesignerType = typeof(AnnLineDrawDesigner);lineObj.EditDesignerType = typeof(AnnLineEditDesigner);lineObj.RunDesignerType = typeof(AnnRunDesigner);using(DrawingContext dc = dv.RenderOpen()){dc.DrawRectangle(new SolidColorBrush(Color.FromRgb(236, 233, 216)), null, new Rect(0, 0, 24, 24));dc.DrawLine(new Pen(Brushes.Black, 2), new Point(4, 4), new Point(22, 22));dc.Close();RenderTargetBitmap bmp = new RenderTargetBitmap(24, 24, 96, 96, PixelFormats.Pbgra32);bmp.Render(dv);lineObj.ToolBarButtonImage = bmp;}lineObj.ToolBarButtonToolTip = new ToolTip();lineObj.ToolBarButtonToolTip.Content = "Draw new line object";lineObj.DrawCursor = Cursors.Cross;lineObj.ContextMenu = AnnAutomationManager.CreateDefaultObjectContextMenu(lineObj.Id);manager.Objects.Add(lineObj);// set up the rectangle automation objectAnnAutomationObject rectObj = new AnnAutomationObject();rectObj.Id = AnnAutomationManager.RectangleObjectId;rectObj.Name = "Rectangle";AnnRectangleObject rect = new AnnRectangleObject();rect.StrokeThickness = 2.0;rect.Stroke = Colors.Red;rect.Fill = Colors.White;rectObj.Object = rect;rectObj.DrawDesignerType = typeof(AnnRectangleDrawDesigner);rectObj.EditDesignerType = typeof(AnnRectangleEditDesigner);rectObj.RunDesignerType = typeof(AnnRunDesigner);using(DrawingContext dc = dv.RenderOpen()){dc.DrawRectangle(new SolidColorBrush(Color.FromRgb(236, 233, 216)), null, new Rect(0, 0, 24, 24));dc.DrawRectangle(null, new Pen(Brushes.Black, 2), new Rect(2, 4, 20, 18));dc.Close();RenderTargetBitmap bmp = new RenderTargetBitmap(24, 24, 96, 96, PixelFormats.Pbgra32);bmp.Render(dv);rectObj.ToolBarButtonImage = bmp;}rectObj.ToolBarButtonToolTip = new ToolTip();rectObj.ToolBarButtonToolTip.Content = "Draw new rectangle object";rectObj.DrawCursor = Cursors.Cross;rectObj.ContextMenu = AnnAutomationManager.CreateDefaultObjectContextMenu(rectObj.Id);manager.Objects.Add(rectObj);// set up the group automation object (always needed)AnnAutomationObject groupObj = new AnnAutomationObject();groupObj.Id = AnnAutomationManager.GroupObjectId;groupObj.Name = "Group";groupObj.Object = new AnnGroupObject();groupObj.DrawDesignerType = null;groupObj.EditDesignerType = typeof(AnnGroupEditDesigner);groupObj.RunDesignerType = typeof(AnnRunDesigner);groupObj.ToolBarButtonImage = null; // group is not in the toolbargroupObj.ToolBarButtonToolTip = null;groupObj.DrawCursor = null;groupObj.ContextMenu = AnnAutomationManager.CreateDefaultObjectContextMenu(groupObj.Id);manager.Objects.Add(groupObj);}}private void AnnAutomationManager_AnnAutomationManager(string title){MyWindow1 window = new MyWindow1(title);window.ShowDialog();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Examples;using Leadtools.Silverlight.Demos;private class MyWindow1 : ChildWindow{AnnAutomationManager manager;ImageViewer viewer;public MyWindow1(string title){this.Title = title;this.Width = 400;this.Height = 400;viewer = new ImageViewer();// load an image into the viewer// fix this path to an existing image file on your systemviewer.Source = new BitmapImage(new Uri(LeadtoolsExamples.Common.ImagesPath.Path + "ScarletMacaws.jpg"));viewer.Width = double.NaN;viewer.Height = double.NaN;// create and set up the automation managermanager = new AnnAutomationManager();// Create only the line and rectangle automation objectsCreateMyAutomationObjects(manager);// You can instruct the manager to create the default (all) automation objects.// comment out the call to CreateMyAutomationObjects and call this instead://theManager.CreateDefaultObjects();// create the toolbar and add it to the ToolBarTraymanager.CreateToolBar();StackPanel dp = new StackPanel();dp.Children.Add(viewer);// set the DockPanel as a content of the window.this.Content = dp;// set up the automation (will create the container as well)AnnAutomation automation = new AnnAutomation(manager, viewer);// set up this automation as the active oneautomation.Active = true;automation.UndoCapacity = 12;}private void CreateMyAutomationObjects(AnnAutomationManager manager){// set up the select automation objectAnnAutomationObject selObj = new AnnAutomationObject();selObj.Id = AnnAutomationManager.SelectObjectId;selObj.Name = "Select";selObj.Object = null;selObj.DrawDesignerType = typeof(AnnRectangleDrawDesigner);selObj.EditDesignerType = null;selObj.RunDesignerType = null;// create the toolbar button (or you can load the image from a disk file or resource){Canvas myCanvas = new Canvas();WriteableBitmap wb1 = new WriteableBitmap(100, 100);Rectangle myRect = new Rectangle();myRect.Width = 24;myRect.Height = 24;myRect.Fill = new SolidColorBrush(Color.FromArgb(255, 236, 233, 216));myCanvas.Children.Add(myRect);Line line1 = new Line();line1.Fill = new SolidColorBrush(Colors.Black);line1.X1 = 4;line1.Y1 = 4;line1.X2 = 22;line1.Y2 = 22;myCanvas.Children.Add(line1);Line line2 = new Line();line2.Fill = new SolidColorBrush(Colors.Black);line2.X1 = 22;line2.Y1 = 4;line2.X2 = 22;line2.Y2 = 4;myCanvas.Children.Add(line2);wb1.Render(myCanvas, null);wb1.Invalidate();selObj.ToolBarButtonImage = wb1;}selObj.ToolBarButtonToolTip = new ToolTip();selObj.ToolBarButtonToolTip.Content = "Select";selObj.DrawCursor = Cursors.Hand;AnnSelectObject selectObj = new AnnSelectObject();selectObj.Stroke = Colors.White;selectObj.StrokeThickness = 2.0;selObj.Object = selectObj;manager.Objects.Add(selObj);// set up the line automation objectAnnAutomationObject lineObj = new AnnAutomationObject();lineObj.Id = AnnAutomationManager.LineObjectId;lineObj.Name = "Line";AnnLineObject line = new AnnLineObject();line.Stroke = Colors.Red;line.StrokeThickness = 2.0;lineObj.Object = line;lineObj.DrawDesignerType = typeof(AnnLineDrawDesigner);lineObj.EditDesignerType = typeof(AnnLineEditDesigner);lineObj.RunDesignerType = typeof(AnnRunDesigner);{Canvas myCanvas = new Canvas();WriteableBitmap wb2 = new WriteableBitmap(100, 100);Rectangle myRect = new Rectangle();myRect.Width = 24;myRect.Height = 24;myRect.Fill = new SolidColorBrush(Color.FromArgb(255, 236, 233, 216));myCanvas.Children.Add(myRect);Line line1 = new Line();line1.Fill = new SolidColorBrush(Colors.Black);line1.X1 = 4;line1.Y1 = 4;line1.X2 = 22;line1.Y2 = 22;myCanvas.Children.Add(line1);wb2.Render(myCanvas, null);wb2.Invalidate();lineObj.ToolBarButtonImage = wb2;}lineObj.ToolBarButtonToolTip = new ToolTip();lineObj.ToolBarButtonToolTip.Content = "Draw new line object";lineObj.DrawCursor = Cursors.Arrow;manager.Objects.Add(lineObj);// set up the rectangle automation objectAnnAutomationObject rectObj = new AnnAutomationObject();rectObj.Id = AnnAutomationManager.RectangleObjectId;rectObj.Name = "Rectangle";AnnRectangleObject rect = new AnnRectangleObject();rect.StrokeThickness = 2.0;rect.Stroke = Colors.Red;rect.Fill = Colors.White;rectObj.Object = rect;rectObj.DrawDesignerType = typeof(AnnRectangleDrawDesigner);rectObj.EditDesignerType = typeof(AnnRectangleEditDesigner);rectObj.RunDesignerType = typeof(AnnRunDesigner);{Canvas myCanvas = new Canvas();WriteableBitmap wb2 = new WriteableBitmap(100, 100);Rectangle myRect = new Rectangle();myRect.Width = 24;myRect.Height = 24;myRect.Fill = new SolidColorBrush(Color.FromArgb(255, 236, 233, 216));myCanvas.Children.Add(myRect);Line line1 = new Line();line1.Fill = new SolidColorBrush(Colors.Black);line1.X1 = 2;line1.Y1 = 4;line1.X2 = 20;line1.Y2 = 18;myCanvas.Children.Add(line1);wb2.Render(myCanvas, null);wb2.Invalidate();rectObj.ToolBarButtonImage = wb2;}rectObj.ToolBarButtonToolTip = new ToolTip();rectObj.ToolBarButtonToolTip.Content = "Draw new rectangle object";rectObj.DrawCursor = Cursors.Stylus;manager.Objects.Add(rectObj);// set up the group automation object (always needed)AnnAutomationObject groupObj = new AnnAutomationObject();groupObj.Id = AnnAutomationManager.GroupObjectId;groupObj.Name = "Group";groupObj.Object = new AnnGroupObject();groupObj.DrawDesignerType = null;groupObj.EditDesignerType = typeof(AnnGroupEditDesigner);groupObj.RunDesignerType = typeof(AnnRunDesigner);groupObj.ToolBarButtonImage = null; // group is not in the toolbargroupObj.ToolBarButtonToolTip = null;groupObj.DrawCursor = null;manager.Objects.Add(groupObj);}}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsImports Leadtools.Silverlight.DemosPrivate Class MyWindow1 : Inherits ChildWindowPrivate manager As AnnAutomationManagerPrivate viewer As ImageViewerPublic Sub New(ByVal title As String)Me.Title = titleMe.Width = 400Me.Height = 400viewer = New ImageViewer()' load an image into the viewer' fix this path to an existing image file on your systemviewer.Source = New BitmapImage(New Uri(LeadtoolsExamples.Common.ImagesPath.Path & "ScarletMacaws.jpg"))viewer.Width = Double.NaNviewer.Height = Double.NaN' create and set up the automation managermanager = New AnnAutomationManager()' Create only the line and rectangle automation objectsCreateMyAutomationObjects(manager)' You can instruct the manager to create the default (all) automation objects.' comment out the call to CreateMyAutomationObjects and call this instead:'theManager.CreateDefaultObjects();' create the toolbar and add it to the ToolBarTraymanager.CreateToolBar()Dim dp As StackPanel = New StackPanel()dp.Children.Add(viewer)' set the DockPanel as a content of the window.Me.Content = dp' set up the automation (will create the container as well)Dim automation As AnnAutomation = New AnnAutomation(manager, viewer)' set up this automation as the active oneautomation.Active = Trueautomation.UndoCapacity = 12End SubPrivate Sub CreateMyAutomationObjects(ByVal manager As AnnAutomationManager)' set up the select automation objectDim selObj As AnnAutomationObject = New AnnAutomationObject()selObj.Id = AnnAutomationManager.SelectObjectIdselObj.Name = "Select"selObj.Object = NothingselObj.DrawDesignerType = GetType(AnnRectangleDrawDesigner)selObj.EditDesignerType = NothingselObj.RunDesignerType = Nothing' create the toolbar button (or you can load the image from a disk file or resource)Dim myCanvas1 As Canvas = New Canvas()Dim wb1 As WriteableBitmap = New WriteableBitmap(100, 100)Dim myRect1 As Rectangle = New Rectangle()myRect1.Width = 24myRect1.Height = 24myRect1.Fill = New SolidColorBrush(Color.FromArgb(255, 236, 233, 216))myCanvas1.Children.Add(myRect1)Dim myline1 As Line = New Line()myline1.Fill = New SolidColorBrush(Colors.Black)myline1.X1 = 4myline1.Y1 = 4myline1.X2 = 22myline1.Y2 = 22myCanvas1.Children.Add(myline1)Dim myline2 As Line = New Line()myline2.Fill = New SolidColorBrush(Colors.Black)myline2.X1 = 22myline2.Y1 = 4myline2.X2 = 22myline2.Y2 = 4myCanvas1.Children.Add(myline2)wb1.Render(myCanvas1, Nothing)wb1.Invalidate()selObj.ToolBarButtonImage = wb1selObj.ToolBarButtonToolTip = New ToolTip()selObj.ToolBarButtonToolTip.Content = "Select"selObj.DrawCursor = Cursors.HandDim selectObj As AnnSelectObject = New AnnSelectObject()selectObj.Stroke = Colors.WhiteselectObj.StrokeThickness = 2.0selObj.Object = selectObjmanager.Objects.Add(selObj)' set up the line automation objectDim lineObj As AnnAutomationObject = New AnnAutomationObject()lineObj.Id = AnnAutomationManager.LineObjectIdlineObj.Name = "Line"Dim line As AnnLineObject = New AnnLineObject()line.Stroke = Colors.Redline.StrokeThickness = 2.0lineObj.Object = linelineObj.DrawDesignerType = GetType(AnnLineDrawDesigner)lineObj.EditDesignerType = GetType(AnnLineEditDesigner)lineObj.RunDesignerType = GetType(AnnRunDesigner)Dim myCanvas2 As Canvas = New Canvas()Dim wb2 As WriteableBitmap = New WriteableBitmap(100, 100)Dim myRect2 As Rectangle = New Rectangle()myRect2.Width = 24myRect2.Height = 24myRect2.Fill = New SolidColorBrush(Color.FromArgb(255, 236, 233, 216))myCanvas2.Children.Add(myRect2)Dim line1 As Line = New Line()line1.Fill = New SolidColorBrush(Colors.Black)line1.X1 = 4line1.Y1 = 4line1.X2 = 22line1.Y2 = 22myCanvas2.Children.Add(line1)wb2.Render(myCanvas2, Nothing)wb2.Invalidate()lineObj.ToolBarButtonImage = wb2lineObj.ToolBarButtonToolTip = New ToolTip()lineObj.ToolBarButtonToolTip.Content = "Draw new line object"lineObj.DrawCursor = Cursors.Arrowmanager.Objects.Add(lineObj)' set up the rectangle automation objectDim rectObj As AnnAutomationObject = New AnnAutomationObject()rectObj.Id = AnnAutomationManager.RectangleObjectIdrectObj.Name = "Rectangle"Dim rect As AnnRectangleObject = New AnnRectangleObject()rect.StrokeThickness = 2.0rect.Stroke = Colors.Redrect.Fill = Colors.WhiterectObj.Object = rectrectObj.DrawDesignerType = GetType(AnnRectangleDrawDesigner)rectObj.EditDesignerType = GetType(AnnRectangleEditDesigner)rectObj.RunDesignerType = GetType(AnnRunDesigner)Dim myCanvas3 As Canvas = New Canvas()Dim wb3 As WriteableBitmap = New WriteableBitmap(100, 100)Dim myRect As Rectangle = New Rectangle()myRect.Width = 24myRect.Height = 24myRect.Fill = New SolidColorBrush(Color.FromArgb(255, 236, 233, 216))myCanvas3.Children.Add(myRect)Dim ln As Line = New Line()ln.Fill = New SolidColorBrush(Colors.Black)ln.X1 = 2ln.Y1 = 4ln.X2 = 20ln.Y2 = 18myCanvas3.Children.Add(ln)wb3.Render(myCanvas3, Nothing)wb3.Invalidate()rectObj.ToolBarButtonImage = wb2rectObj.ToolBarButtonToolTip = New ToolTip()rectObj.ToolBarButtonToolTip.Content = "Draw new rectangle object"rectObj.DrawCursor = Cursors.Stylusmanager.Objects.Add(rectObj)' set up the group automation object (always needed)Dim groupObj As AnnAutomationObject = New AnnAutomationObject()groupObj.Id = AnnAutomationManager.GroupObjectIdgroupObj.Name = "Group"groupObj.Object = New AnnGroupObject()groupObj.DrawDesignerType = NothinggroupObj.EditDesignerType = GetType(AnnGroupEditDesigner)groupObj.RunDesignerType = GetType(AnnRunDesigner)groupObj.ToolBarButtonImage = Nothing ' group is not in the toolbargroupObj.ToolBarButtonToolTip = NothinggroupObj.DrawCursor = Nothingmanager.Objects.Add(groupObj)End SubEnd Class
|
Products |
Support |
Feedback: AnnAutomationManager Class - Leadtools.Windows.Annotations |
Introduction |
Help Version 19.0.2017.3.22
|

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.