Accusoft.NotateXpress13.Net
Group or Ungroup Annotations

To group annotations on a layer programmatically, create a new group within the layer's group collection. Then add the annotation to the new group. 

C# Example
Copy Code
// create a new group on the layer
Layer layer = notateXpress1.Layers.Selected();
if(layer == null)
{
MessageBox.Show("A Layer must be selected before a Group operation can be performed");
return;
}
Accusoft.NotateXpressSdk.Group group = new Accusoft.NotateXpressSdk.Group();
layer.Groups.Add(group);

// add all selected annotations to the new group
Element element = layer.Elements.FirstSelected();
while(element != null)
{
if(element.Selected)
group.GroupElements.Add(element);
element = layer.Elements.NextSelected();
}

Move the Annotations in the Group

If the annotations in a group are yoked, they can be selected and moved or sized as a group. Selecting, moving, or sizing one annotation in the group automatically applies to all annotations in the group. 

C# Example
Copy Code
// ensure that the group is yoked
group.Yoked = true;
// move the group

 

Deleting an annotation in a yoked group, or modifying the attributes (e.g. color) of an annotation in a yoked group has no effect on the other annotations in the group. 

UnGroup Annotations

To disassociate one or more annotations from the group, call the GroupElementCollection methods: Remove, RemoveAt, and Clear methods. The annotations that are removed from the group remain on the layer, but no longer are associated. 

C# Example
Copy Code
// remove selected annotations from the group
// these annotations remain on the layer, but are no longer associated with the group
Element element = layer.Elements.FirstSelected();
while(element != null)
{
if(element.Selected)
group.GroupElements.Remove(element);
element = layer.Elements.NextSelected();
}

 

See Also

 

 


©2019. Accusoft Corporation. All Rights Reserved.

Send Feedback