LEADTOOLS Annotations (Leadtools.Annotations assembly)
LEAD Technologies, Inc

Group Property

Example 





Gets or sets the AnnGroupObject that contains this AnnObject.
Syntax
public virtual AnnGroupObject Group {get; set;}
'Declaration
 
Public Overridable Property Group As AnnGroupObject
'Usage
 
Dim instance As AnnObject
Dim value As AnnGroupObject
 
instance.Group = value
 
value = instance.Group
public virtual AnnGroupObject Group {get; set;}
 get_Group();
set_Group(value);
public:
virtual property AnnGroupObject^ Group {
   AnnGroupObject^ get();
   void set (    AnnGroupObject^ value);
}

Property Value

The AnnGroupObject that contains this AnnObject.
Remarks

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

When adding or removing objects to or from a group, 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 group (if any) to which a certain object currently belongs.

Example
 
Public Sub AnnObject_Group()
   ' add an object to the first container
   Dim line As AnnLineObject = New AnnLineObject()
   line.Name = "Line1"
   ShowGroupAndContainer(line)

   ' add it to a group
   Dim group As AnnGroupObject = New AnnGroupObject()
   group.Name = "Group1"
   group.Objects.Add(line)

   ShowGroupAndContainer(line)

   ' add the group to a container
   Dim container As AnnContainer = New AnnContainer()
   container.Name = "Container1"
   container.Objects.Add(group)

   ShowGroupAndContainer(line)
End Sub

Private Sub ShowGroupAndContainer(ByVal obj As AnnObject)
   Console.Write("Container: ")
   If Not obj.Container Is Nothing Then
      Console.Write(obj.Container.Name)
   Else
      Console.Write("none")
   End If

   Console.Write(", Group: ")
   If Not obj.Group Is Nothing Then
      Console.Write(obj.Group.Name)
   Else
      Console.Write("none")
   End If

   Console.WriteLine()
End Sub
public void AnnObject_Group()
{
   // add an object to the first container
   AnnLineObject line = new AnnLineObject();
   line.Name = "Line1";
   ShowGroupAndContainer(line);

   // add it to a group
   AnnGroupObject group = new AnnGroupObject();
   group.Name = "Group1";
   group.Objects.Add(line);

   ShowGroupAndContainer(line);

   // add the group to a container
   AnnContainer container = new AnnContainer();
   container.Name = "Container1";
   container.Objects.Add(group);

   ShowGroupAndContainer(line);
}

private void ShowGroupAndContainer(AnnObject obj)
{
   Console.Write("Container: ");
   if(obj.Container != null)
      Console.Write(obj.Container.Name);
   else
      Console.Write("none");

   Console.Write(", Group: ");
   if(obj.Group != null)
      Console.Write(obj.Group.Name);
   else
      Console.Write("none");

   Console.WriteLine();
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

AnnObject Class
AnnObject Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.