Ungroups this AnnGroupObject object.
public virtual void Ungroup()
Public Overridable Sub Ungroup()
public:
virtual void Ungroup();
Ungrouping an AnnGroupObject object moves all the objects in this group to the group's Container. After ungrouping is done, the group's Objects collection will be empty. This method does not remove this AnnGroupObject object from the Container. For more information about grouping and ungrouping, refer to Grouping and Ungrouping Annotation Objects (Deprecated).
This example groups/ungroups objects.
using Leadtools;
using Leadtools.Annotations;
using Leadtools.Codecs;
using Leadtools.WinForms;
private void AnnGroupObject_Ungroup()
{
AnnContainer container = new AnnContainer();
// adds a few objects to the container
AnnLineObject line = new AnnLineObject();
container.Objects.Add(line);
AnnRectangleObject rect = new AnnRectangleObject();
container.Objects.Add(rect);
// show the number of objects in this container (should be 2: line and rectangle)
string s = string.Format("There are {0} objects in the container", container.Objects.Count); ;
MessageBox.Show(s);
// move all objects from the container to a group
AnnGroupObject group = new AnnGroupObject();
while (container.Objects.Count > 0)
{
AnnObject obj = container.Objects[0];
container.Objects.Remove(obj);
group.Objects.Add(obj);
}
// show the number of objects in this container (should be 0)
s = string.Format("There are {0} objects in the container", container.Objects.Count);
MessageBox.Show(s);
// add the group to the container
container.Objects.Add(group);
// show the number of objects in this container (should be 1: group)
s = string.Format("There are {0} objects in the container", container.Objects.Count);
MessageBox.Show(s);
// ungroup the group object
group.Ungroup();
// show the number of objects in this container (should be 3: group, line and rectangle)
s = string.Format("There are {0} objects in the container", container.Objects.Count);
MessageBox.Show(s);
// remove the group from the container
container.Objects.Remove(group);
// show the number of objects in this container (should be 2: line and rectangle)
s = string.Format("There are {0} objects in the container", container.Objects.Count);
MessageBox.Show(s);
}
Imports Leadtools
Imports Leadtools.Annotations
Imports Leadtools.Codecs
Imports Leadtools.WinForms
Private Sub AnnGroupObject_Ungroup()
Dim container As AnnContainer = New AnnContainer()
' adds a few objects to the container
Dim line As AnnLineObject = New AnnLineObject()
container.Objects.Add(line)
Dim rect As AnnRectangleObject = New AnnRectangleObject()
container.Objects.Add(rect)
' show the number of objects in this container (should be 2: line and rectangle)
Dim s As String = String.Format("There are {0} objects in the container", container.Objects.Count)
MessageBox.Show(s)
' move all objects from the container to a group
Dim group As AnnGroupObject = New AnnGroupObject()
Do While container.Objects.Count > 0
Dim obj As AnnObject = container.Objects(0)
container.Objects.Remove(obj)
group.Objects.Add(obj)
Loop
' show the number of objects in this container (should be 0)
s = String.Format("There are {0} objects in the container", container.Objects.Count)
MessageBox.Show(s)
' add the group to the container
container.Objects.Add(group)
' show the number of objects in this container (should be 1: group)
s = String.Format("There are {0} objects in the container", container.Objects.Count)
MessageBox.Show(s)
' ungroup the group object
group.Ungroup()
' show the number of objects in this container (should be 3: group, line and rectangle)
s = String.Format("There are {0} objects in the container", container.Objects.Count)
MessageBox.Show(s)
' remove the group from the container
container.Objects.Remove(group)
' show the number of objects in this container (should be 2: line and rectangle)
s = String.Format("There are {0} objects in the container", container.Objects.Count)
MessageBox.Show(s)
End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET