If a diagram represents a tree structure, the tree branch starting from a node can be collapsed or expanded again in order to hide or display hierarchy details. Use the node's Collapse and Expand methods to do this programmatically. To determine whether a sub-tree is expanded or collapsed check its root's Expanded property.
If the Expandable property of a node is set to true, there is a +/- button displayed beside the node to allow users to collapse or expand the tree branch starting there. The button location and the +/- icons can be customized via the flowchart's ExpandBtnPos and ButtonImages properties. Pressing that button calls the Collapse and Expand methods automatically. This behavior can be overridden by setting the fOverrideTreeExpanding flag in EventFlags. That makes the respective events still raised when a user clicks on the +/- buttons, without actually hiding or showing child nodes in the tree.
A node can be connected to other nodes through outgoing and incoming arrows. Setting the ExpandOnIncoming property specifies which items connected to a node will be regarded as its descendants. If ExpandOnIncoming is false (default value) then each node will be regarded as a parent of its outgoing arrows and the objects attached to them. If ExpandOnIncoming is set to true, the node's incoming arrows define its children. So that property specifies the direction of parent-children relationship between diagram items and respectively the overall direction in which collapsing / expanding is done.
Use the RecursiveExpand property to specify whether the whole sub-tree starting from a node will be shown when expanding, or only the first level of descendants.