FlowChartX allows attaching a node to another diagram element, establishing a subordinate - master relationship between the two objects. When a master element is moved or resized, any subordinated node follows it, so that the initial distance between the two objects stays constant. This happens both when a user moves the master object around, and when the object position is changed using a method or a property.
An unit of attached objects is managed by creating and manipulating a Group instance. To create a group with a specific master object, call the CreateGroup method and use the Group methods to attach items. Every member of a group can be the master object of another group, i.e. an item can be subordinate in one group and meanwhile be another group's master. FlowChartX doesn't impose any limits to the depth and width of group hierarchies built that way. However, it is not possible to put an item as a subordinate in more than one groups because the hierarchy relations would become ambiguous.
It is possible to create such groups, that if any item in the hierarchy is modified, all other items are updated too. This can be done by putting the items in circular chain of dependencies - i.e. object1 is attached to object2, object2 to object3 ... objectN to object1. If any of these objects is modified, the change will propagate through the chain until it reaches its originator.
Arrows cannot be attached to groups but can be main objects of groups. If a group's main object is an arrow, nodes can be attached to the control points or segments of the arrow. See the AttachToArrowPoint, AttachToArrowSegment and AttachToLongestHSegment methods for details. If the master object is a node, other nodes can be attached to any of its corners, or to an area specified as percent of master-node's bounding rectangle. Check AttachToCorner and AttachProportional for details.
Group members can be accessed using the MainObject property and the AttachedBoxes / AttachedTables collections. To get the groups in which an item participates, use its MasterGroup and SubordinateGroup properties.
Groups can be destroyed programmatically using the DestroyGroup method. When a user deletes the main object of a group, the group is destroyed automatically but the attached objects are not deleted. If you need to delete them with the group, you could do this programmatically in the method that handles the GroupDestroyed event. That event is raised just before the group's memory is freed so in the handler method you are still able to enumerate the attached objects. The following VB example shows how this can be done:
VB Copy Code |
---|
Private Sub fc_GroupDestroyed(ByVal group As FLOWCHARTLibCtl.IGroupItem) |