private void Init() { var document = this.Document; _documentListView.Items.Add(new ListViewItem(new string[] { "Document ID", document.DocumentId })); var uriType = "URL"; var uriValue = "none"; var uri = document.Uri; if (uri != null) { if (uri.IsFile) { uriType = "File"; uriValue = uri.LocalPath; } else { uriType = "URL"; uriValue = uri.ToString(); } } _documentListView.Items.Add(new ListViewItem(new string[] { uriType, uriValue })); _documentListView.Items.Add(new ListViewItem(new string[] { "MIME Type", document.MimeType })); _documentListView.Items.Add(new ListViewItem(new string[] { "Encrypted", document.IsDecrypted ? "Yes" : "No" })); uri = document.Annotations.AnnotationsUri; if (uri != null) { if (uri.IsFile) { _documentListView.Items.Add(new ListViewItem(new string[] { "Annotations file", uri.LocalPath })); } else { _documentListView.Items.Add(new ListViewItem(new string[] { "Annotations URL", uri.ToString() })); } } var pageCount = document.Pages.Count; _documentListView.Items.Add(new ListViewItem(new string[] { "Pages", pageCount.ToString() })); if (pageCount > 0) { var page = document.Pages[0]; var pageSize = page.Size; var sizeInchdes = LeadSizeD.Create(pageSize.Width / LEADDocument.UnitsPerInch, pageSize.Height / LEADDocument.UnitsPerInch); var sizePixels = page.SizeToPixels(pageSize); _documentListView.Items.Add(new ListViewItem(new string[] { "Page size", string.Format("{0} x {1} in ({2} x {3} px)", sizeInchdes.Width, sizeInchdes.Height, sizePixels.Width, sizePixels.Height) })); } foreach (var iter in document.Metadata) { _metadataListView.Items.Add(new ListViewItem(new string[] { iter.Key, iter.Value })); } }
private AnnThumbStyle CreateRotateGripperThumbStyle() { AnnThumbStyle rotateGripperThumbStyle = new AnnEllipseThumbStyle(); double thumbSize = ThumbSize; rotateGripperThumbStyle.Size = LeadSizeD.Create(thumbSize, thumbSize); rotateGripperThumbStyle.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("black"), LeadLengthD.Create(1)); rotateGripperThumbStyle.Fill = AnnSolidColorBrush.Create("lightgreen"); return(rotateGripperThumbStyle); }
private AnnThumbStyle CreateLocationThumbStyle() { AnnThumbStyle locationThumbStyle = new AnnRectangleThumbStyle(); double thumbSize = ThumbSize; locationThumbStyle.Size = LeadSizeD.Create(thumbSize, thumbSize); locationThumbStyle.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("black"), LeadLengthD.Create(1)); locationThumbStyle.Fill = AnnSolidColorBrush.Create("lightblue"); return(locationThumbStyle); }
private void _printDocument_PrintPage(object sender, PrintPageEventArgs e) { // Get the print document object PrintDocument document = sender as PrintDocument; SvgDocument svgDoc = _viewer.DocumentList[_currentPrintPageNumber - 1].Document; var svgResolution = svgDoc.Bounds.Resolution; var svgBounds = svgDoc.Bounds.Bounds; // Get page size in pixels var pixelSize = LeadSizeD.Create(svgBounds.Width, svgBounds.Height); using (Bitmap bitmap = new Bitmap((int)pixelSize.Width, (int)pixelSize.Height, PixelFormat.Format32bppPArgb)) { // Convert to DPI var size = LeadSizeD.Create(pixelSize.Width * bitmap.HorizontalResolution / svgResolution.Width, pixelSize.Height * bitmap.VerticalResolution / svgResolution.Height).ToLeadSize(); // Fit in the margin bounds var destRect = LeadRect.Create(e.MarginBounds.X, e.MarginBounds.Y, e.MarginBounds.Width, e.MarginBounds.Height); destRect = RasterImage.CalculatePaintModeRectangle( size.Width, size.Height, destRect, RasterPaintSizeMode.Fit, RasterPaintAlignMode.Center, RasterPaintAlignMode.Center); using (Graphics g = Graphics.FromImage(bitmap)) { using (var engine = RenderingEngineFactory.Create(g)) { var options = new SvgRenderOptions(); options.Bounds = svgBounds; svgDoc.Render(engine, options); } } e.Graphics.DrawImage(bitmap, destRect.X, destRect.Y, destRect.Width, destRect.Height); } // Go to the next page _currentPrintPageNumber++; // Inform the printer whether we have more pages to print if (_currentPrintPageNumber <= document.PrinterSettings.ToPage) { e.HasMorePages = true; } else { e.HasMorePages = false; } }
/// <summary> /// Called by the main form to add a new page to the document /// </summary> public void AddPage(RasterImage page, int width, int height) { _rasterImageViewer.Image.AddPage(page); ResetViewerTransforms(); AnnContainer container = new AnnContainer(); container.Mapper = _annAutomation.Container.Mapper.Clone(); container.Size = container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(width, height)); SetViewerTransforms(); _annAutomation.Containers.Add(container); }
public void Identity() { if (_documents.Count == 0) { return; } if (_documents[_currentPageIndex].Document == null) { return; } var svgBounds = _documents[_currentPageIndex].Document.Bounds; var bounds = svgBounds.Bounds; var transform = LeadMatrix.Identity; if (_useDpi) { var imageSize = this.ImageSize; var resolution = LeadSizeD.Create(96, 96); if (!svgBounds.Resolution.IsEmpty) { if (svgBounds.Resolution.Width > 0) { resolution.Width = svgBounds.Resolution.Width; } if (svgBounds.Resolution.Height > 0) { resolution.Height = svgBounds.Resolution.Height; } } transform.Scale( (double)96.0 / resolution.Width, (double)96.0 / resolution.Height); } this.Transform = transform; Invalidate(); }
/// <summary> /// Called by the main form to set the new raster image and OCR page /// </summary> /// <param name="image"></param> /// <param name="ocrPage"></param> public void SetImageAndPage(RasterImage image, IOcrPage ocrPage) { _ocrPage = ocrPage; var options = _rasterImageViewer.AutoResetOptions; // save _rasterImageViewer.AutoResetOptions = ImageViewerAutoResetOptions.None; _rasterImageViewer.Image = image; _rasterImageViewer.AutoResetOptions = options; if (image != null) { AnnContainerMapper saveMapper = _annAutomation.Container.Mapper.Clone(); AnnContainerMapper identityMapper = new AnnContainerMapper(saveMapper.SourceDpiX, saveMapper.SourceDpiY, saveMapper.SourceDpiX, saveMapper.SourceDpiY); identityMapper.UpdateTransform(LeadMatrix.Identity); _annAutomation.Container.Mapper = identityMapper; //Set Container Size if (_annAutomation != null) { _annAutomation.Container.Size = identityMapper.SizeToContainerCoordinates(LeadSizeD.Create(image.ImageWidth, image.ImageHeight)); } _annAutomation.Container.Mapper = saveMapper; // Converts the zones to annotation objects ZonesUpdated(); _rasterImageViewer.ViewBorderThickness = 1; } else { _rasterImageViewer.ViewBorderThickness = 0; } UpdateTitle(); UpdateUIState(); }
/// <summary> /// Called by the main form to set a new document into the viewer /// </summary> public void SetDocument(RasterImage image) { try { if (_annAutomationManager != null) { _rasterImageViewer.Image = image; //we shoud reset viewer transforms before creating automation and setting its container size ResetViewerTransforms(); //Set Container Size if (_annAutomation.Container == null) { _annAutomation.Containers.Add(new AnnContainer()); _annAutomation.Container.Mapper.MapResolutions(image.XResolution, image.YResolution, image.XResolution, image.YResolution); } _annAutomation.Container.Size = _annAutomation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(image.ImageWidth, image.ImageHeight)); SetViewerTransforms(); UpdateUIState(); } } catch (Exception ex) { Messager.ShowError(this, ex); } }
private void Form1_Load(object sender, EventArgs e) { viewer = new ImageViewer(); viewer.Dock = DockStyle.Fill; automationControl = new ImageViewerAutomationControl(); automationControl.ImageViewer = viewer; ScreenCaptureEngine.Startup(); scEngine.CaptureInformation += new EventHandler <ScreenCaptureInformationEventArgs>(scEngine_CaptureInformation); ScreenCaptureOptions captureOptions = scEngine.CaptureOptions; captureOptions.Hotkey = Keys.None; scEngine.CaptureOptions = captureOptions; // initialize a new RasterCodecs object RasterCodecs codecs = new RasterCodecs(); // load the main image into the viewer viewer.Image = codecs.Load(@"C:\Users\Public\Documents\LEADTOOLS Images\OCR1.TIF"); viewer.Zoom(ControlSizeMode.FitAlways, 1.0, viewer.DefaultZoomOrigin); // initialize the interactive mode for the viewer AutomationInteractiveMode automationInteractiveMode = new AutomationInteractiveMode(); automationInteractiveMode.AutomationControl = automationControl; // add the interactive mode to the viewer viewer.InteractiveModes.BeginUpdate(); viewer.InteractiveModes.Add(automationInteractiveMode); viewer.InteractiveModes.EndUpdate(); if (viewer.Image != null) { // create and set up the automation manager annAutomationManager = new AnnAutomationManager(); annAutomationManager.RestrictDesigners = true; annAutomationManager.EditObjectAfterDraw = false; // Instruct the manager to create all of the default automation objects. annAutomationManager.CreateDefaultObjects(); AnnObservableCollection <AnnAutomationObject> annObservable = annAutomationManager.Objects; foreach (AnnAutomationObject annObject in annObservable) { if (annObject.Id != AnnObject.SelectObjectId) { // annObservable.Remove(annObject); // annAutomationManager.Objects.Remove(annObject); } } // initialize the manager helper and create the toolbar and add it then the viewer to the controls AutomationManagerHelper managerHelper = new AutomationManagerHelper(annAutomationManager); managerHelper.CreateToolBar(); managerHelper.ToolBar.Dock = DockStyle.Right; Controls.Add(managerHelper.ToolBar); Controls.Add(viewer); // set up the automation (it will create the container as well) automation = new AnnAutomation(annAutomationManager, automationControl); automation.EditContent += new EventHandler <AnnEditContentEventArgs>(automation_EditContent); // set this automation as the active one automation.Active = true; //set the size of the container to the size of the viewer automation.Container.Size = automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(viewer.Image.ImageWidth, viewer.Image.ImageHeight)); } }
private void OpenDataset(string file, bool loadDefaultImage) { if (File.Exists(file)) { Cursor = Cursors.WaitCursor; bool bImageLoaded = false; try { try { _dsImage.Load(file, DicomDataSetLoadFlags.LoadAndClose); bImageLoaded = ShowImage(); // Update the container size _automation.Container.Size = _automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(_viewer.Image.ImageWidth, _viewer.Image.ImageHeight)); } catch (Exception) { string msg = string.Format("Failed to load '{0}'. Make sure that this is a valid DICOM file.", file); Messager.ShowError(this, msg); return; } if (_dsImage.InformationClass == DicomClassType.BasicDirectory) { Messager.ShowError(this, "This demo does not support opening Dicom Directory datasets. " + "Please see the Dicom Directory demo."); return; } //if dicom file loaded successfully if (bImageLoaded) { UpdateTree(); //Load ".pre" File string fileName = Path.GetFileNameWithoutExtension(file) + ".pre"; string DirectoryName = Path.GetDirectoryName(file); CloseAnnotations(); LoadAnnotationFile(Path.Combine(DirectoryName, fileName), loadDefaultImage); } } catch (Exception exception) { System.Diagnostics.Debug.Assert(false); throw exception; } finally { Cursor = Cursors.Arrow; } if (_treeView_Elements.Nodes.Count > 0) { _treeView_Elements.SelectedNode = _treeView_Elements.Nodes[0]; } } else { Messager.ShowError(this, String.Format("\"{0}\" Not Found", Path.GetFileName(file))); } }
public void Initialize(RasterPaintProperties paintProperties, RasterImage image, string fileName) { InitClass(); Text = fileName; _viewer.Image = image; UpdatePaintProperties(paintProperties); AnnAutomation automation = new AnnAutomation(MainForm.AutomationManager, _automationControl); // Update the container size automation.Container.Size = automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(_viewer.Image.ImageWidth, _viewer.Image.ImageHeight)); automation.Container.Children.CollectionChanged += new EventHandler <AnnNotifyCollectionChangedEventArgs>(Children_CollectionChanged); automation.Container.Mapper.FontRelativeToDevice = false; automation.DeserializeObjectError += new EventHandler <AnnSerializeObjectEventArgs>(automation_DeserializeObjectError); MainForm.UpdateControls(); }
public void Initialize(RasterPaintProperties paintProperties, RasterImage image, string fileName, int pageNumber) { InitClass(); Text = fileName; _viewer.Image = image; _automationControl.AutomationDataProvider = new RasterImageAutomationDataProvider(image); UpdatePaintProperties(paintProperties); InitInteractiveModes(); AnnAutomation automation = new AnnAutomation(MainForm.AutomationManager, _automationControl); // Update the container size automation.Container.Size = automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(_viewer.Image.ImageWidth, _viewer.Image.ImageHeight)); automation.EditText += new EventHandler <AnnEditTextEventArgs>(automation_EditText); automation.EditContent += new EventHandler <AnnEditContentEventArgs>(automation_EditContent); automation.Container.Children.CollectionChanged += new EventHandler <AnnNotifyCollectionChangedEventArgs>(Children_CollectionChanged); automation.Container.Mapper.FontRelativeToDevice = false; automation.AfterObjectChanged += new EventHandler <AnnAfterObjectChangedEventArgs>(automation_AfterObjectChanged); automation.CurrentDesignerChanged += new EventHandler(automation_CurrentDesignerChanged); automation.UndoRedoChanged += new EventHandler(automation_UndoRedoChanged); automation.OnShowContextMenu += new EventHandler <AnnAutomationEventArgs>(automation_OnShowContextMenu); automation.OnShowObjectProperties += new EventHandler <AnnAutomationEventArgs>(automation_OnShowObjectProperties); automation.LockObject += new EventHandler <AnnLockObjectEventArgs>(automation_LockObject); automation.UnlockObject += new EventHandler <AnnLockObjectEventArgs>(automation_UnlockObject); automation.DeserializeObjectError += new EventHandler <AnnSerializeObjectEventArgs>(automation_DeserializeObjectError); automation.SetCursor += new EventHandler <AnnCursorEventArgs>(automation_SetCursor); automation.RestoreCursor += new EventHandler(automation_RestoreCursor); automation.ToolTip += new EventHandler <AnnToolTipEventArgs>(automation_ToolTip); MainForm.UpdateControls(); }
protected override void OnLoad(EventArgs e) { if (!DesignMode) { _automationManager = new AnnAutomationManager(); _automationManager.GroupsRoles = _groupsRoles; _automationManager.RedactionRealizePassword = string.Empty; _automationManager.CreateDefaultObjects(); _managerHelper = new AutomationManagerHelper(_automationManager); _managerHelper.CreateToolBar(); tabControl1.TabPages[1].Controls.Add(_managerHelper.ToolBar); _imageViewer = new AutomationImageViewer(); _imageViewer.KeyDown += new KeyEventHandler(_imageViewer_KeyDown); tabControl1.TabPages[1].Controls.Add(_imageViewer); _managerHelper.ToolBar.Dock = DockStyle.Right; _managerHelper.ToolBar.AutoSize = false; _managerHelper.ToolBar.Appearance = ToolBarAppearance.Flat; _managerHelper.ToolBar.BringToFront(); _imageViewer.Dock = DockStyle.Fill; _imageViewer.UseDpi = false; _imageViewer.ImageHorizontalAlignment = Leadtools.Controls.ControlAlignment.Center; _imageViewer.ImageBorderColor = Color.Black; _imageViewer.ImageBorderThickness = 1; _imageViewer.BringToFront(); AutomationInteractiveMode automationInteractiveMode = new AutomationInteractiveMode(); automationInteractiveMode.MouseButtons = MouseButtons.Left | MouseButtons.Right; _imageViewer.InteractiveModes.Add(automationInteractiveMode); using (RasterCodecs codec = new RasterCodecs()) { _imageViewer.Image = codec.Load(DemosGlobal.ImagesFolder + @"\ocr1.tif"); _imageViewer.Zoom(Leadtools.Controls.ControlSizeMode.FitWidth, 1, LeadPoint.Empty); } _automation = new AnnAutomation(_automationManager, _imageViewer); // Update the container size _automation.Container.Size = _automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(_imageViewer.Image.ImageWidth, _imageViewer.Image.ImageHeight)); _automation.EditText += new EventHandler <AnnEditTextEventArgs>(automation_EditText); _automation.OnShowContextMenu += new EventHandler <AnnAutomationEventArgs>(automation_OnShowContextMenu); _automation.OnShowObjectProperties += new EventHandler <AnnAutomationEventArgs>(automation_OnShowObjectProperties); _automation.LockObject += new EventHandler <AnnLockObjectEventArgs>(automation_LockObject); _automation.UnlockObject += new EventHandler <AnnLockObjectEventArgs>(automation_UnlockObject); _automation.SetCursor += new EventHandler <AnnCursorEventArgs>(automation_SetCursor); _automation.RestoreCursor += new EventHandler(automation_RestoreCursor); FlipReverseText(_automationManager.RenderingEngine, true); _automation.Active = true; _chkLstGroups.CheckOnClick = true; _chkLstGroups.ItemCheck += new ItemCheckEventHandler(_chkLstGroups_ItemCheck); _chkLstGroups.Enabled = _lstUsers.Items.Count > 0 && _lstUsers.SelectedIndex >= 0; _chkLstRoles.CheckOnClick = true; _chkLstRoles.ItemCheck += new ItemCheckEventHandler(_chkLstRoles_ItemCheck); _chkLstRoles.Items.Add(new CheckRoleItem(AnnRoles.View)); _chkLstRoles.Items.Add(new CheckRoleItem(AnnRoles.ViewAll)); _chkLstRoles.Items.Add(new CheckRoleItem(AnnRoles.Edit)); _chkLstRoles.Items.Add(new CheckRoleItem(AnnRoles.EditAll)); _chkLstRoles.Items.Add(new CheckRoleItem(CustomRoles.RulersOnly)); _lstGroups.SelectedIndexChanged += new EventHandler(_lstGroups_SelectedIndexChanged); _chkLstRoles.Enabled = _lstGroups.Items.Count > 0 && _lstGroups.SelectedIndex >= 0; _lstUsers.SelectedIndexChanged += new EventHandler(_lstUsers_SelectedIndexChanged); _groupsRoles.GenerateRole += new EventHandler <AnnOperationInfoEventArgs>(_groupsRoles_GenerateRole); AnnRoles medicalRoles = new AnnRoles(); medicalRoles.Add(CustomRoles.RulersOnly); AddGroup(_groupsRoles, "Medical", medicalRoles); AnnRoles documentRoles = new AnnRoles(); documentRoles.Add(AnnRoles.View); documentRoles.Add(AnnRoles.Edit); AddGroup(_groupsRoles, "Document", documentRoles); AnnRoles adminRoles = new AnnRoles(); adminRoles.Add(AnnRoles.EditAll); AddGroup(_groupsRoles, "Admins", adminRoles); AnnRoles guestRoles = new AnnRoles(); guestRoles.Add(AnnRoles.ViewAll); AddGroup(_groupsRoles, "Guests", guestRoles); AddUser(_groupsRoles, "Medical", "MedicalUser"); AddUser(_groupsRoles, "Document", "DocumentUser"); AddUser(_groupsRoles, "Guests", "Guest"); AddUser(_groupsRoles, "Admins", "Admin"); OnResize(EventArgs.Empty); } base.OnLoad(e); }
protected override void OnLoad(EventArgs e) { if (!DesignMode) { _automationManager = AnnAutomationManager.Create(new AnnWinFormsRenderingEngine()); _automationManager.RedactionRealizePassword = string.Empty; _automationManager.CreateDefaultObjects(); _managerHelper = new AutomationManagerHelper(_automationManager); _managerHelper.CreateToolBar(); FlipReverseText(_automationManager.RenderingEngine, true); _managerHelper.ToolBar.Dock = DockStyle.Right; _managerHelper.ToolBar.AutoSize = false; _managerHelper.ToolBar.Width = 100; _managerHelper.ToolBar.Appearance = ToolBarAppearance.Normal; this.Controls.Add(_managerHelper.ToolBar); _managerHelper.ToolBar.BringToFront(); _imageViewer = new AutomationImageViewer(); _imageViewer.KeyDown += new KeyEventHandler(_imageViewer_KeyDown); _imageViewer.Dock = DockStyle.Fill; this.Controls.Add(_imageViewer); _imageViewer.BringToFront(); AutomationInteractiveMode automationInteractiveMode = new AutomationInteractiveMode(); automationInteractiveMode.MouseButtons = MouseButtons.Left | MouseButtons.Right; _imageViewer.InteractiveModes.Add(automationInteractiveMode); _imageViewer.UseDpi = false; _imageViewer.Zoom(Leadtools.Controls.ControlSizeMode.FitWidth, 1, LeadPoint.Empty); _imageViewer.ImageHorizontalAlignment = Leadtools.Controls.ControlAlignment.Center; _imageViewer.ImageBorderColor = Color.Black; _imageViewer.BorderStyle = BorderStyle.Fixed3D; _imageViewer.ImageBorderThickness = 1; using (RasterCodecs codec = new RasterCodecs()) { _imageViewer.Image = codec.Load(DemosGlobal.ImagesFolder + @"\ocr1.tif"); _imageViewer.AutomationDataProvider = new RasterImageAutomationDataProvider(_imageViewer.Image); } _automation = new AnnAutomation(_automationManager, _imageViewer); // Update the container size _automation.Container.Size = _automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(_imageViewer.Image.ImageWidth, _imageViewer.Image.ImageHeight)); _automation.EditText += new EventHandler <AnnEditTextEventArgs>(automation_EditText); _automation.OnShowContextMenu += new EventHandler <AnnAutomationEventArgs>(automation_OnShowContextMenu); _automation.OnShowObjectProperties += new EventHandler <AnnAutomationEventArgs>(automation_OnShowObjectProperties); _automation.LockObject += new EventHandler <AnnLockObjectEventArgs>(automation_LockObject); _automation.UnlockObject += new EventHandler <AnnLockObjectEventArgs>(automation_UnlockObject); _automation.SetCursor += new EventHandler <AnnCursorEventArgs>(automation_SetCursor); _automation.RestoreCursor += new EventHandler(automation_RestoreCursor); _automation.Active = true; _tvLayers.BeginUpdate(); _tvLayers.HideSelection = false; AnnLayer layer = AnnLayer.Create("Container"); AnnObjectCollection children = _automation.Container.Children; foreach (AnnObject annObject in children) { layer.Children.Add(annObject); } _containerNode = new LayerNode(layer, null, false); _containerNode.Tag = "Container"; _tvLayers.Nodes.Add(_containerNode); _tvLayers.EndUpdate(); CreateDefaultLayers(); OnResize(EventArgs.Empty); } base.OnLoad(e); }
public BatesStampDialog(RasterImage image, AnnBatesStampComposer targetComposer) { if (targetComposer == null) { throw new ArgumentNullException("targetComposer"); } _targetComposer = targetComposer; _composer = new AnnBatesStampComposer(); //if target container already have stamp then add it to dialog composer foreach (AnnBatesStamp stamp in _targetComposer.Stamps) { _composer.Stamps.Add(stamp.Clone()); } InitializeComponent(); #if !USE_ImageViewerAutomationControl _viewer = new ImageViewer(); var automationControl = new ImageViewerAutomationControl(); automationControl.ImageViewer = _viewer; #else _viewer = new AutomationImageViewer(); IAnnAutomationControl automationControl = _viewer; #endif _groupBoxViewer.Controls.Add(_viewer); _viewer.Dock = DockStyle.Fill; _viewer.Image = image; automationControl.AutomationDataProvider = new RasterImageAutomationDataProvider(image); _manager.RenderingEngine = new AnnWinFormsRenderingEngine(); AnnBatesStampComposer.RenderingEngine = _manager.RenderingEngine; _manager.CreateDefaultObjects(); _automation = new AnnAutomation(_manager, automationControl); // Update the container size _automation.Container.Size = _automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(_viewer.Image.ImageWidth, _viewer.Image.ImageHeight)); _automation.Active = true; //Attach automation active container to _composer to start editing it _composer.TargetContainers.Add(_automation.Container); _listBoxContainerStamps.DataSource = _stampsList; _stampsList.ListChanged += new ListChangedEventHandler(_stampsList_ListChanged); if (_composer.Stamps.Count > 0) { _currentBatesStamp = _composer.Stamps[0]; UpdateControls(); for (int i = 0; i < _composer.Stamps.Count; i++) { AnnBatesStamp stamp = _composer.Stamps[i]; stamp.FriendlyName = string.Concat(stamp.FriendlyName, i); _stampsList.Add(stamp); } } }