Nevron .NET Vision Documentation

Groups are shapes, which aggregate other shapes. Groups are represented by the NGroup class, which derives from NShape class. You can construct a group from any types of shapes - including other groups. Groups are by default treated as 2D shapes. Groups support drill down selection, which means that you can select the shapes contained in a group.

Aggregated Shapes
The shapes, which a group aggregates are stored in an instance of the NShapeCollection class, which can be obtained from the Shapes property. In this way a group can contain any type of other shapes - including other groups.
Creating groups

Groups are created similarly to composite shapes. The difference is that groups can contain only shapes. The following example creates a group, which contains three shapes:

Copy Code
NGroup group = new NGroup();

// create ellipse
NEllipseShape ellipse = new NEllipseShape(0, 0, 100, 100);
ellipse.Text = "Ellipse";

// create rectangle
NRectangleShape rect = new NRectangleShape(150, 0, 100, 100);
rect.Text = "Rectangle";

// create line
NLineShape line = new NLineShape(0, 150, 100, 250);
line.Text = "Line";

// update the model bounds of the group
Visual Basic
Copy Code
Dim group As New NGroup()

' create ellipse
Dim ellipse As New NEllipseShape(0, 0, 100, 100)
ellipse.Text = "Ellipse"

' create rectangle
Dim rect As New NRectangleShape(150, 0, 100, 100)
rect.Text = "Rectangle"

' create line
Dim line As New NLineShape(0, 150, 100, 250)
line.Text = "Line"

' update the model bounds of the group

It is important to remember that you must call the UpdateModelBounds method of the group once you have finished adding shapes to it. This is necessary in order for the group to adopt the bounds of the shapes it contains (see Models for more information about aggregate models bounds).

Empty Groups

Since the user can select the shapes contained in a group, this allows him/her to delete all shapes of a group - i.e. make an empty group. 

You can protect a group from becoming empty with the help of the CanBeEmpty property. If this property is set to false the user will not be able to delete the last shape of a group.

You can also instruct groups to automatically destroy themselves when the become empty. This is specified by the AutoDestroy property. If this property is set to true the group will automatically destroy itself when its last child is removed. 

Grouping is the process of creating a new group from a set of already existing shapes. The shapes, which must be grouped must have a group permission. When shapes are grouped they are deleted from the current composite in which they reside (a layer or another group) and added to the Shapes collection of the newly created group. The grouped shapes will retain their position and size in scene coordinates.

This operation is implemented by the NBatchGroup class.
Ungrouping is the process of destruction of an existing group. The group must have an ungroup permission in order to be ungrouped. You can optionally specify a composite in which the group shapes must be added. 

This operation is implemented by the NBatchUngroup class. 
Related Examples
Windows Forms: Document Object Model - Shapes - Groups folder 
See Also



©2019. Nevron Software LLC.

Send Feedback