コード例 #1
0
        // DrillDown is implemented by just changing the diagram models
        protected override void OnMouseClick(EventArgs e)
        {
            try
            {
                int flag = 0;
                // Get node root.
                Syncfusion.Windows.Forms.Diagram.Model diagramModel = this.Root;
                Node node = this as IGraphNode as Node;

                if (node is TextNode)
                {
                    //|| node is MyGroup2 || node is MyGroup3)
                    node.EditStyle.AllowSelect = false;
                }
                else
                {
                    if (flag == 0)
                    {
                        this.dig.Controller.SelectAll();
                        this.dig.Controller.Delete();
                        this.mod1.Nodes.Clear();
                        flag = 1;
                    }

                    Syncfusion.Windows.Forms.Diagram.TextNode txtnode1 = new TextNode(" Coevals Diagram ");
                    txtnode1.FontStyle.Size   = 16;
                    txtnode1.FontStyle.Family = "Arial";
                    txtnode1.FontStyle.Bold   = true;

                    txtnode1.FontColorStyle.Color = Color.MidnightBlue;
                    txtnode1.LineStyle.LineColor  = Color.Transparent;
                    txtnode1.SizeToText(new Size(1000, 1000));
                    txtnode1.PinPoint = new PointF(335, 25);
                    this.dig.Model.AppendChild(txtnode1);

                    this.dig.Model.AppendChild(new HomeNode(this.dig, this.mod1, this.mod2));

                    // Grand Mother
                    GM          = new GrandMotherSymbolClass();
                    GM.PinPoint = new PointF(305, 145);

                    this.dig.Model.AppendChild(GM);

                    // GrandMothers Daiughter
                    GMDaughter.PinPoint = new PointF(150, 200);
                    this.dig.Model.AppendChild(GMDaughter);

                    // Connection b/w Grandma and her daughter
                    ConnectNodes(GM, GMDaughter);

                    // GrandMothers Son
                    GMSon          = new ManSymbolClass();
                    GMSon.PinPoint = new PointF(450, 200);
                    this.dig.Model.AppendChild(GMSon);

                    // Connection b/w Grandma and her Son
                    ConnectNodes(GM, GMSon);



                    // Boy
                    BoySymbolClass mySymbolBoy3 = new BoySymbolClass("Boys", this.dig, this.mod1, this.mod2);
                    mySymbolBoy3.Name     = "Boys";
                    mySymbolBoy3.PinPoint = new PointF(450, 290);

                    //ToolTip
                    this.dig.Model.AppendChild(mySymbolBoy3);


                    //mySymbolBoy3 = new MySymbol4Girl();

                    // Connection b/w Father and his girl
                    ConnectNodes(GMSon, mySymbolBoy3);

                    // Girl
                    mySymbolGirl          = new GirlSymbolClass();
                    mySymbolGirl.PinPoint = new PointF(370, 290);
                    this.dig.Model.AppendChild(mySymbolGirl);

                    // Connection b/w Father and his girl
                    ConnectNodes(GMSon, mySymbolGirl);

                    // Girl
                    mySymbolGirl          = new GirlSymbolClass();
                    mySymbolGirl.PinPoint = new PointF(520, 290);
                    this.dig.Model.AppendChild(mySymbolGirl);

                    // Connection b/w Father and his girl
                    ConnectNodes(GMSon, mySymbolGirl);

                    // Mother Childerns
                    // Girl
                    mySymbolGirl          = new GirlSymbolClass();
                    mySymbolGirl.PinPoint = new PointF(150, 290);
                    this.dig.Model.AppendChild(mySymbolGirl);

                    // Connection b/w Father and his girl
                    ConnectNodes(GMDaughter, mySymbolGirl);

                    // Girl
                    GirlSymbolClass mySymbolGirl3 = new GirlSymbolClass("Girls", this.dig, this.mod1, this.mod2);
                    mySymbolGirl3.Name     = "Girls";
                    mySymbolGirl3.PinPoint = new PointF(220, 290);
                    this.dig.Model.AppendChild(mySymbolGirl3);

                    // Connection b/w Mother and his girl
                    ConnectNodes(GMDaughter, mySymbolGirl3);

                    // Boy
                    mySymbolBoy          = new BoySymbolClass();
                    mySymbolBoy.PinPoint = new PointF(280, 290);
                    this.dig.Model.AppendChild(mySymbolBoy);
                    // Connection b/w Mother and his girl
                    ConnectNodes(GMDaughter, mySymbolBoy);

                    // Boy
                    mySymbolBoy          = new BoySymbolClass();
                    mySymbolBoy.PinPoint = new PointF(90, 290);
                    this.dig.Model.AppendChild(mySymbolBoy);

                    // Connection b/w Mother and his Boy
                    ConnectNodes(GMDaughter, mySymbolBoy);


                    this.Nodes.Clear();
                    this.dig.View.SelectionList.Clear();
                }
            }
            catch { }
        }
コード例 #2
0
        protected override void OnMouseClick(EventArgs e)
        {
            // Get node root.
            Syncfusion.Windows.Forms.Diagram.Model diagramModel = this.Root;
            Node thisNode = this as IGraphNode as Node;

            if (thisNode.Name.ToString() == "Girls")
            {
                this.diagram1.Controller.SelectAll();
                this.diagram1.Controller.Delete();
                this.model1.Nodes.Clear();

                Syncfusion.Windows.Forms.Diagram.TextNode txtnode1 = new TextNode(" Coevals Diagram ");
                txtnode1.FontStyle.Size      = 20;
                txtnode1.FontStyle.Bold      = true;
                txtnode1.FontStyle.Family    = "Segoe UI";
                txtnode1.LineStyle.LineColor = Color.Transparent;
                txtnode1.SizeToText(new Size(1000, 1000));
                txtnode1.PinPoint = new PointF(335, 25);
                this.diagram1.Model.AppendChild(txtnode1);

                Syncfusion.Windows.Forms.Diagram.TextNode txtnode2 = new TextNode("Friends!");
                txtnode2.FontStyle.Size      = 8;
                txtnode2.FontStyle.Family    = "Segoe UI";
                txtnode2.LineStyle.LineColor = Color.Transparent;
                txtnode2.PinPoint            = new PointF(280, 150);
                txtnode1.SizeToText(new Size(1000, 1000));
                this.diagram1.Model.AppendChild(txtnode2);

                this.diagram1.Model.AppendChild(new HomeNode(this.diagram1, this.model1, this.model2));

                GirlSymbolClass symbol1 = new GirlSymbolClass();
                symbol1.PinPoint = new PointF(280, 120);
                this.diagram1.Model.AppendChild(symbol1);

                GirlSymbolClass symbol2 = new GirlSymbolClass();
                symbol2.PinPoint = new PointF(380, 180);
                this.diagram1.Model.AppendChild(symbol2);

                GirlSymbolClass symbol3 = new GirlSymbolClass();
                symbol3.PinPoint = new PointF(380, 280);
                this.diagram1.Model.AppendChild(symbol3);

                GirlSymbolClass symbol4 = new GirlSymbolClass();
                symbol4.PinPoint = new PointF(280, 320);
                this.diagram1.Model.AppendChild(symbol4);

                GirlSymbolClass symbol5 = new GirlSymbolClass();
                symbol5.PinPoint = new PointF(180, 280);
                this.diagram1.Model.AppendChild(symbol5);

                GirlSymbolClass symbol6 = new GirlSymbolClass();
                symbol6.PinPoint = new PointF(180, 180);
                this.diagram1.Model.AppendChild(symbol6);

                // Grand Mother
                GrandMotherSymbolClass gm = new GrandMotherSymbolClass(this.diagram1, this.model1, this.model2, true);
                gm.PinPoint            = new PointF(65, 30);
                gm.Size                = new SizeF(20, 20);
                gm.LineStyle.LineColor = Color.Transparent;
                this.diagram1.Model.AppendChild(gm);

                ConnectNodes(symbol1, symbol2);
                ConnectNodes(symbol2, symbol3);
                ConnectNodes(symbol4, symbol3);
                ConnectNodes(symbol4, symbol5);
                ConnectNodes(symbol5, symbol6);
                ConnectNodes(symbol1, symbol6);
                this.diagram1.View.SelectionList.Clear();
                this.Nodes.Clear();
            }
        }