LEADTOOLS Annotations (Leadtools.Annotations assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
Container Property
See Also 
Leadtools.Annotations Namespace > AnnObject Class : Container Property



The Container Property is available in LEADTOOLS Document and Medical Imaging toolkits.

Gets or sets the AnnContainer that contains this AnnObject.

Syntax

Visual Basic (Declaration) 
Public Overridable Property Container As AnnContainer
Visual Basic (Usage)Copy Code
Dim instance As AnnObject
Dim value As AnnContainer
 
instance.Container = value
 
value = instance.Container
C# 
public virtual AnnContainer Container {get; set;}
C++/CLI 
public:
virtual property AnnContainer^ Container {
   AnnContainer^ get();
   void set (    AnnContainer^ value);
}

Property Value

The AnnContainer that contains this AnnObject.

Example

This example creates two containers, adds an object to the first container then moves it to the second while checking the AnnObject.Container property of the object.

Visual BasicCopy Code
Public Sub AnnObject_Container()
   ' create 2 containers
   Dim firstContainer As AnnContainer = New AnnContainer()
   firstContainer.Name = "First Container"
   Dim secondContainer As AnnContainer = New AnnContainer()
   secondContainer.Name = "Second Container"
   ' add an object to the first container
   Dim line As AnnLineObject = New AnnLineObject()
   line.Name = "Line1"

   ' add the object to the first container
   firstContainer.Objects.Add(line)
   Dim s As String = String.Format("Container: {0}", line.Container.Name)
   MessageBox.Show(s)

   ' move the object to the second container
   firstContainer.Objects.Remove(line)
   secondContainer.Objects.Add(line)
   s = String.Format("Container: {0}", line.Container.Name)
   MessageBox.Show(s)
End Sub
C#Copy Code
public void AnnObject_Container()
{
   // create 2 containers
   AnnContainer firstContainer = new AnnContainer();
   firstContainer.Name = "First Container";
   AnnContainer secondContainer = new AnnContainer();
   secondContainer.Name = "Second Container";
   // add an object to the first container
   AnnLineObject line = new AnnLineObject();
   line.Name = "Line1";

   // add the object to the first container
   firstContainer.Objects.Add(line);
   string s = string.Format("Container: {0}", line.Container.Name);
   MessageBox.Show(s);

   // move the object to the second container
   firstContainer.Objects.Remove(line);
   secondContainer.Objects.Add(line);
   s = string.Format("Container: {0}", line.Container.Name);
   MessageBox.Show(s);
}

Remarks

An AnnObject can be part of one AnnContainer only at any given time.

When adding or removing objects to or from a container, you do not need to manually set this property to the container value: this operation is performed internally by the LEADTOOLS annotation toolkit. However, you can check the value of this property to determine the container to which a certain object currently belongs.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.Annotations requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features