LEADTOOLS Annotations for WPF and Silverlight (Leadtools.Windows.Annotations assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.31
Clone Method
See Also 
Leadtools.Windows.Annotations Namespace > AnnObject Class : Clone Method



Creates an exact copy of this AnnObject object. Supported in Silverlight, Windows Phone 7

Syntax

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

Return Value

The AnnObject 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 AnnObject In srcContainer.Children
      ' we want to keep the original object intact, so create an exact copy by cloning the object
      Dim destObj As AnnObject = DirectCast(srcObj.Clone(), AnnObject)
      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 (AnnObject srcObj in srcContainer.Children)
   {
      // we want to keep the original object intact, so create an exact copy by cloning the object
      AnnObject destObj = srcObj.Clone() as AnnObject;
      destContainer.Children.Add(destObj);
   }
}
SilverlightCSharpCopy 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 (AnnObject srcObj in srcContainer.Children)
   {
      // we want to keep the original object intact, so create an exact copy by cloning the object
      AnnObject destObj = srcObj.Clone() as AnnObject;
      destContainer.Children.Add(destObj);
   }
}
SilverlightVBCopy 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 AnnObject In srcContainer.Children
      ' we want to keep the original object intact, so create an exact copy by cloning the object
      Dim destObj As AnnObject = TryCast(srcObj.Clone(), AnnObject)
      destContainer.Children.Add(destObj)
   Next srcObj
End Sub

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

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.