Пример #1
0
    /// <summary>
    /// Create a new method for collapse current node
    /// </summary>
    /// <param name="SelectedNode"></param>


    public NodeCollection CollapseSubNodes(bool clickednode)
    {
        NodeCollection collapsedCollection = new NodeCollection();
        IGraphNode     thisNode            = this as IGraphNode;

        if (thisNode != null)
        {
            ICollection edgesLeaving = thisNode.EdgesLeaving;
            if (edgesLeaving != null)
            {
                // Convert to collection of IGraphEdges type.
                foreach (IGraphEdge curEdge in edgesLeaving)
                {
                    // Get from IGraphEdge link.
                    ConnectorBase outlink = curEdge as ConnectorBase;
                    if (outlink != null)
                    {
                        // Get from link current symbol children.
                        EmpSymbol cursymbol = outlink.ToNode as EmpSymbol;
                        if (cursymbol != null)
                        {
                            // Colapse nodes in child symbol.
                            cursymbol.CollapseSubNodes(false);

                            // Set current symbol as invisible.
                            cursymbol.Visible = false;
                        }
                        // Set connected link as invisible too.
                        outlink.Visible = false;
                        //CollapsedCollection.Add(outlink);
                    }
                }
            }
        }
        CollapsedCollection = collapsedCollection;
        // If this symbol is node under mouse click set node state as
        // expaned by make plus vertical line visibly.
        if (clickednode && HasChild())
        {
            // Set symbol shapes to indicate a collapsed state.
            m_bExpanded = false;
        }
        return(collapsedCollection);
    }