←Select platform

AttachContainer Method

Attaches this AnnAutomation object to a container and optional undo/redo object.
public virtual void AttachContainer( 
   AnnContainer container, 
   AnnAutomationUndoRedoObject undoRedoObject 
- (void)attachContainer:(nullable LTAnnContainer *)container undoRedo:(nullable LTAnnAutomationUndoRedoObject *)undoRedoObject NS_SWIFT_NAME(attach(_:undoRedo:)); 
public void attachContainer(AnnContainer container, AnnAutomationUndoRedoObject undoRedoObject); 
   virtual void AttachContainer( 
      AnnContainer^ container, 
      AnnAutomationUndoRedoObject^ undoRedoObject 
def AttachContainer(self,container,undoRedoObject): 


The annotation container to attach this automation to. This value cannot be null.

Optional undo/redo object that contains the internal data.


You can use this method to attach this AnnAutomation object to an existing container. This could be useful in a multipage annotation application for instance as shown in the example.

undoRedoObject must be either null or the value returned from GetUndoRedoObject that holds the data the previous time container was attached to this automation object.


This example will show how a multipage annotation application would use a single automation object to annotate multiple containers.

using Leadtools.Annotations.Automation; 
using Leadtools.Annotations.Engine; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Annotations.Rendering; 
using Leadtools.Annotations.WinForms; 
public void AnnAutomation_AttachContainer() 
   // create a new annotation object 
   _automation = new AnnAutomation(_manager, _viewer); 
   AnnRedactionObject redaction = new AnnRedactionObject(); 
   redaction.Rect = LeadRectD.Create(100, 100, 200, 200); 
   redaction.Fill = AnnSolidColorBrush.Create("red"); 
   for (int page = 1; page <= _viewer.Image.PageCount; page++) 
   //Invalidate the AnnAutomation 
   //Realize all AnnRedactionObjects 
   //Both firstRedaction and secondRedaction are burned to the image 
   //Select the first AnnRedactionObject 
   //Restore the image data that was previously redacted by firstRedaction 
   //The image data redacted by secondRedaction will remain redacted 
   // AnnAutomation Undo on properties just changed: CanCopy, CanDeleteObject, CanFlip, CanLock 
   // Create a new annotation container and attach 
   AnnContainer container = new AnnContainer(); 
   // Size in annotation units (1/720 of an inch) and attaching container 
   container.Size = LeadSizeD.Create(8.5 * 720, 11 * 720); 
   AnnAutomationUndoRedoObject annAutomationUndoRedoObject = _automation.GetUndoRedoObject(); 
   _automation.AttachContainer(container, annAutomationUndoRedoObject); 
   // List of available annotation objects 
   AnnAutomationManager annAutomationManager = _automation.Manager; 
   Debug.WriteLine($"\nList of Available Annotation Objects:\n"); 
   foreach (var annAutoManagerObject in annAutomationManager.Objects) 
      Debug.WriteLine($"* {annAutoManagerObject.Name}"); 

Target Platforms

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

Leadtools.Annotations.Automation Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.