Leadtools.Windows.Annotations Requires Document/Medical license. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Clone Method
See Also  Example
Leadtools.Windows.Annotations Namespace > AnnObjectBase Class : Clone Method



Creates an exact copy of this AnnObjectBase object.

Syntax

Visual Basic (Declaration) 
Public Overridable Function Clone() As AnnObjectBase
Visual Basic (Usage)Copy Code
Dim instance As AnnObjectBase
Dim value As AnnObjectBase
 
value = instance.Clone()
C# 
public virtual AnnObjectBase Clone()
C++/CLI 
public:
virtual AnnObjectBase^ Clone(); 

Return Value

The AnnObjectBase object that this class creates.

Example

This example copies the objects from one container to another.

Visual BasicCopy Code
Public Sub AnnObject_Clone(ByVal srcContainer As AnnContainer, ByVal destContainer As AnnContainer)
   ' first remove all objects from the destination container
   destContainer.Children.Clear()
   ' copy the objects from the src to the destination container
   For Each srcObj As AnnObjectBase In srcContainer.Children
      ' we want to keep the original object intact, so create an exact copy by cloning the object
      Dim destObj As AnnObjectBase = CType(IIf(TypeOf srcObj.Clone() Is AnnObjectBase, srcObj.Clone(), Nothing), AnnObjectBase)
      destContainer.Children.Add(destObj)
   Next srcObj
End Sub
C#Copy Code
public void AnnObject_Clone(AnnContainer srcContainer, AnnContainer destContainer) 

   // first remove all objects from the destination container 
   destContainer.Children.Clear(); 
   // copy the objects from the src to the destination container 
   foreach(AnnObjectBase srcObj in srcContainer.Children) 
   { 
      // we want to keep the original object intact, so create an exact copy by cloning the object 
      AnnObjectBase destObj = srcObj.Clone() as AnnObjectBase; 
      destContainer.Children.Add(destObj); 
   } 
}

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also

Clone requires a Document/Medical product license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features and Unlocking Special LEAD Features.