示例#1
0
        void diagram1_MouseMove(object sender, MouseEventArgs e)
        {
            ExpanderNode node = diagram1.Controller.GetNodeAtPoint(diagram1.Controller.ConvertToModelCoordinates(e.Location)) as ExpanderNode;

            if (node != null)
            {
                node.MouseMove(diagram1.Controller.ConvertToModelCoordinates(e.Location));
            }
        }
示例#2
0
    public NodeCollection ExpandSubNodes(bool clickednode)
    {
        NodeCollection expandCollection = new NodeCollection();

        ExpandedCollection = new NodeCollection();
        IGraphNode thisNode = this as IGraphNode;

        if (thisNode != null)
        {
            ICollection edgesLeaving = thisNode.EdgesLeaving;
            if (edgesLeaving != null)
            {
                foreach (IGraphEdge curEdge in edgesLeaving)
                {
                    // Get from IGraphEdge link.
                    ConnectorBase outlink = curEdge as ConnectorBase;

                    if (outlink != null)
                    {
                        // Get from link children of current symbol.
                        ExpanderNode cursymbol = outlink.ToNode as ExpanderNode;
                        if (cursymbol != null)
                        {
                            // Check for explanded and explande nodes in child symbol.
                            if (cursymbol.IsExpanded)
                            {
                                cursymbol.ExpandSubNodes(false);
                            }

                            // Set current symbol as visible.
                            cursymbol.Visible = true;
                            expandCollection.Add(cursymbol);
                        }

                        // Set connected link as visible too.
                        outlink.Visible = true;
                        expandCollection.Add(outlink);
                    }
                }
            }
        }
        ExpandedCollection = expandCollection;
        // 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 an expanded state.
            m_bExpanded = true;
        }
        return(expandCollection);
    }
示例#3
0
    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.
                        ExpanderNode cursymbol = outlink.ToNode as ExpanderNode;
                        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);
    }
示例#4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            diagram1.BeginUpdate();
            diagram1.View.Grid.Visible    = false;
            diagram1.View.BackgroundColor = Color.White;

            comboDirection.SelectedIndex                = 0;
            diagram1.MouseMove                         += new MouseEventHandler(diagram1_MouseMove);
            diagram1.EventSink.NodeMouseEnter          += new Syncfusion.Windows.Forms.Diagram.NodeMouseEventHandler(EventSink_NodeMouseEnter);
            diagram1.Model.RenderingStyle.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            diagram1.Model.BoundaryConstraintsEnabled   = false;
            for (int i = 0; i <= 11; i++)
            {
                ExpanderNode expander = new ExpanderNode(new RectangleF(0, 0, 90, 60));
                expander.Name = i.ToString();
                diagram1.Model.AppendChild(expander);
            }

            Connect(diagram1.Model.Nodes["0"], diagram1.Model.Nodes["1"]);
            Connect(diagram1.Model.Nodes["0"], diagram1.Model.Nodes["2"]);
            Connect(diagram1.Model.Nodes["2"], diagram1.Model.Nodes["3"]);
            Connect(diagram1.Model.Nodes["2"], diagram1.Model.Nodes["4"]);
            Connect(diagram1.Model.Nodes["2"], diagram1.Model.Nodes["5"]);
            Connect(diagram1.Model.Nodes["5"], diagram1.Model.Nodes["6"]);
            Connect(diagram1.Model.Nodes["5"], diagram1.Model.Nodes["7"]);
            Connect(diagram1.Model.Nodes["1"], diagram1.Model.Nodes["8"]);
            Connect(diagram1.Model.Nodes["1"], diagram1.Model.Nodes["9"]);
            Connect(diagram1.Model.Nodes["1"], diagram1.Model.Nodes["10"]);
            Connect(diagram1.Model.Nodes["1"], diagram1.Model.Nodes["11"]);

            LayoutNodes();

            diagram1.EndUpdate();
            comboDirection.SelectedIndexChanged += new EventHandler(comboDirection_SelectedIndexChanged);
            diagram1.Controller.InPlaceEditor.LabelEditingCompleted += InPlaceEditor_LabelEditingCompleted;
        }