Esempio n. 1
0
        /// <summary>
        /// Connect the nodes
        /// </summary>
        /// <param name="parentNode">parent node</param>
        /// <param name="position">node's position</param>
        private void ConnectNodes(Node parentNode, string position)
        {
            if (parentNode.CentralPort == null)
            {
                return;
            }
            PointF[]            pts;
            OrthogonalConnector line;

            this.diagram1.Model.BeginUpdate();

            // Create directed link
            if (position == "right")
            {
                pts  = new PointF[] { parentNode.PinPoint, new PointF(parentNode.PinPoint.X + 200, parentNode.PinPoint.Y) };
                line = new OrthogonalConnector(pts[0], pts[1]);
            }
            else
            {
                pts  = new PointF[] { parentNode.PinPoint, new PointF(parentNode.PinPoint.X - 150, parentNode.PinPoint.Y + 220) };
                line = new OrthogonalConnector(pts[0], pts[1], true);
            }
            line.HeadDecorator.DecoratorShape  = DecoratorShape.Filled45Arrow;
            line.HeadDecorator.FillStyle.Color = Color.Black;
            line.LineStyle.LineColor           = Color.Black;

            this.diagram1.Model.AppendChild(line);

            parentNode.CentralPort.TryConnect(line.TailEndPoint);
            this.diagram1.Model.SendToBack(line);

            this.diagram1.Model.EndUpdate();
        }
Esempio n. 2
0
        /// <summary>
        /// Connects the nodes
        /// </summary>
        /// <param name="parentNode">Parent node</param>
        /// <param name="subNode">Child node</param>
        private void ConnectNodes(Node parentNode, Node subNode)
        {
            if (parentNode.CentralPort == null || subNode.CentralPort == null)
            {
                return;
            }

            this.diagram1.Model.BeginUpdate();

            // Create directed link
            PointF[]            pts  = new PointF[] { PointF.Empty, new PointF(0, 1) };
            OrthogonalConnector line = new OrthogonalConnector(pts[0], pts[1]);

            line.HeadDecorator.DecoratorShape  = DecoratorShape.Filled45Arrow;
            line.HeadDecorator.FillStyle.Color = Color.Black;
            line.LineStyle.LineColor           = Color.Black;

            this.diagram1.Model.AppendChild(line);

            parentNode.CentralPort.TryConnect(line.TailEndPoint);
            subNode.CentralPort.TryConnect(line.HeadEndPoint);
            this.diagram1.Model.SendToBack(line);

            this.diagram1.Model.EndUpdate();
        }
Esempio n. 3
0
        /// <summary>
        /// Connects the nodes
        /// </summary>
        /// <param name="parent">Tail node</param>
        /// <param name="child">Head node</param>
        private void ConnectNodes(Node parent, Node child, bool useOrthogonal)
        {
            ConnectorBase conn;
            if (!useOrthogonal)
                conn = new LineConnector(PointF.Empty, new PointF(0, 1));
            else
                conn = new OrthogonalConnector(parent.PinPoint, child.PinPoint, false);

            conn.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;
            conn.HeadDecorator.FillStyle.Color = Color.Black;
            diagram1.Model.AppendChild(conn);
            parent.CentralPort.Connect(conn.TailEndPoint);
            child.CentralPort.Connect(conn.HeadEndPoint);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes the Diagram data
        /// </summary>
        private void InitializeDiagram()
        {
            LineConnector line = new LineConnector(new PointF[] { new PointF(320, 135), new PointF(480, 135) });

            line.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow;
            line.HeadDecorator.Size           = new SizeF(10, 10);
            line.LineStyle.LineWidth          = 1;
            AddLabel(line, "DirectedLink", Position.BottomCenter);
            diagram1.Model.AppendChild(line);

            OrthogonalConnector orthogonalLine = new OrthogonalConnector(new PointF(50, 50), new PointF(245, 135));

            orthogonalLine.HeadDecorator.DecoratorShape = DecoratorShape.OpenFancyArrow;
            orthogonalLine.HeadDecorator.Size           = new SizeF(10, 10);
            orthogonalLine.TailDecorator.DecoratorShape = DecoratorShape.FilledFancyArrow;
            orthogonalLine.TailDecorator.Size           = new SizeF(10, 10);
            orthogonalLine.LineStyle.LineWidth          = 1;
            AddLabel(orthogonalLine, "OrthogonalLink", Position.BottomCenter);
            diagram1.Model.AppendChild(orthogonalLine);

            OrgLineConnector orgLine = new OrgLineConnector(new PointF(245, 200), new PointF(50, 285));

            orgLine.HeadDecorator.DecoratorShape = DecoratorShape.FilledDiamond;
            orgLine.HeadDecorator.Size           = new SizeF(10, 10);
            orgLine.TailDecorator.DecoratorShape = DecoratorShape.Diamond;
            orgLine.TailDecorator.Size           = new SizeF(10, 10);
            orgLine.LineStyle.LineWidth          = 1;
            AddLabel(orgLine, "OrgLineLink", Position.BottomCenter);
            diagram1.Model.AppendChild(orgLine);

            PolyLineConnector polyLine = new PolyLineConnector(new PointF[] { new PointF(320, 225), new PointF(455, 225), new PointF(320, 265), new PointF(455, 265) });

            polyLine.HeadDecorator.DecoratorShape = DecoratorShape.Circle;
            polyLine.HeadDecorator.Size           = new SizeF(10, 10);
            polyLine.TailDecorator.DecoratorShape = DecoratorShape.FilledCircle;
            polyLine.TailDecorator.Size           = new SizeF(10, 10);
            polyLine.LineStyle.LineWidth          = 1;
            AddLabel(polyLine, "PolylineLink", Position.BottomCenter);
            diagram1.Model.AppendChild(polyLine);

            SplineNode spline = new SplineNode(new PointF[] { new PointF(100, 400), new PointF(160, 430), new PointF(100, 480) });

            spline.HeadDecorator.DecoratorShape = DecoratorShape.FilledSquare;
            spline.HeadDecorator.Size           = new SizeF(10, 10);
            spline.TailDecorator.DecoratorShape = DecoratorShape.Square;
            spline.TailDecorator.Size           = new SizeF(10, 10);
            spline.LineStyle.LineWidth          = 1;
            AddLabel(spline, "Spline", Position.BottomCenter);
            diagram1.Model.AppendChild(spline);
        }
Esempio n. 5
0
        /// <summary>
        /// Connect the ParentNode's Port and ChildNode's Port
        /// </summary>
        /// <param name="parentNode">ParentNode's Port</param>
        /// <param name="childNode">ChildNode's Port</param>
        /// <param name="decoratorShape">DecoratorShape of the connector</param>
        /// <param name="labelText">Set the text to the label</param>
        /// <param name="OffsetX">Set the OffsetX to the label</param>
        /// <param name="OffsetY">Set the OffsetY to the label</param>
        /// <param name="DrawImage">Determines whether image should draw with label or not</param>
        /// <param name="classType">Classtype</param>
        private ConnectorBase ConnectNodes(ConnectionPoint parentNode, ConnectionPoint childNode, DecoratorShape decoratorShape, string labelText, float OffsetX, float OffsetY, bool DrawImage, int classType)
        {
            if (parentNode != null && childNode != null)
            {
                OrthogonalConnector lConnector = new OrthogonalConnector(System.Drawing.PointF.Empty, new System.Drawing.PointF(0, 1));
                lConnector.LineRoutingEnabled           = true;
                lConnector.LineRoutingEnabled           = true;
                lConnector.HeadDecorator.DecoratorShape = decoratorShape;
                lConnector.LineStyle.LineColor          = Color.Goldenrod;
                lConnector.LineStyle.LineWidth          = 1;
                lConnector.CentralPort.ConnectionsLimit = 10000;

                ImageLabel imageLabel = new ImageLabel(lConnector, labelText);
                imageLabel.OffsetX      = OffsetX;
                imageLabel.OffsetY      = OffsetY;
                imageLabel.ImageOffsetX = OffsetX - 25;
                imageLabel.ImageOffsetY = OffsetY - 5;
                imageLabel.DrawImage    = DrawImage;
                if (classType == 1)
                {
                    imageLabel.TextImage = System.Drawing.Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\6.png");
                }
                else
                {
                    imageLabel.TextImage = System.Drawing.Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\7.png");
                }
                lConnector.Labels.Add(imageLabel);
                lConnector.HeadDecorator.Size = new System.Drawing.SizeF(12, 12);
                if (decoratorShape == DecoratorShape.Filled45Arrow)
                {
                    lConnector.HeadDecorator.FillStyle.Color = Color.White;
                }
                lConnector.HeadDecorator.LineStyle.LineColor = Color.Goldenrod;
                lConnector.LineRoutingEnabled = true;
                parentNode.TryConnect(lConnector.TailEndPoint);
                childNode.TryConnect(lConnector.HeadEndPoint);
                this.diagram1.Model.AppendChild(lConnector);
                this.diagram1.Model.SendToBack(lConnector);
                return(lConnector);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 6
0
        void LoadDiagram()
        {
            this.diagram1.Model.HistoryManager.Pause();
            this.diagram1.Model.RenderingStyle.SmoothingMode = SmoothingMode.HighQuality;
            Syncfusion.Windows.Forms.Diagram.Ellipse ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(495, 5, 110, 70);
            ellipse.FillStyle.Type      = FillStyleType.LinearGradient;
            ellipse.FillStyle.Color     = Color.FromArgb(51, 153, 255);
            ellipse.FillStyle.ForeColor = Color.FromArgb(51, 153, 255);
            ellipse.LineStyle.LineColor = Color.Black;
            ellipse.LineStyle.LineWidth = 2.0f;
            ellipse.LineStyle.LineJoin  = LineJoin.Miter;
            Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label();
            label.Text             = "Start";
            label.FontStyle.Family = "Arial";
            ellipse.Labels.Add(label);
            diagram1.Model.AppendChild(ellipse);
            Syncfusion.Windows.Forms.Diagram.Rectangle process = new Syncfusion.Windows.Forms.Diagram.Rectangle(500, 100, 100, 70);
            process.FillStyle.Type      = FillStyleType.LinearGradient;
            process.FillStyle.Color     = Color.FromArgb(51, 153, 255);
            process.FillStyle.ForeColor = Color.FromArgb(51, 153, 255);
            process.LineStyle.LineColor = Color.Black;
            process.LineStyle.LineWidth = 2.0f;
            process.LineStyle.LineJoin  = LineJoin.Miter;
            Syncfusion.Windows.Forms.Diagram.Label label2 = new Syncfusion.Windows.Forms.Diagram.Label();
            label2.Text             = "Process";
            label2.FontStyle.Family = "Arial";
            process.Labels.Add(label2);
            diagram1.Model.AppendChild(process);
            OrthogonalConnector link = new OrthogonalConnector(ellipse.PinPoint, process.PinPoint);

            link.LineStyle.LineColor = Color.Black;
            link.LineStyle.LineWidth = 2f;
            diagram1.Model.AppendChild(link);
            link.HeadDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
            link.HeadDecorator.Size                = new SizeF(8, 8);
            link.HeadDecorator.FillStyle.Color     = Color.Black;
            link.HeadDecorator.LineStyle.LineColor = Color.Black;
            ellipse.CentralPort.TryConnect(link.TailEndPoint);
            process.CentralPort.TryConnect(link.HeadEndPoint);
            Polygon decision = new Polygon(new PointF[] { new PointF(0, 50), new PointF(50, 0), new PointF(100, 50), new PointF(50, 100), new PointF(0, 50) });

            decision.FillStyle.Type      = FillStyleType.LinearGradient;
            decision.FillStyle.Color     = Color.FromArgb(51, 153, 255);
            decision.FillStyle.ForeColor = Color.FromArgb(51, 153, 255);
            decision.LineStyle.LineColor = Color.Black;
            decision.LineStyle.LineWidth = 2.0f;
            decision.LineStyle.LineJoin  = LineJoin.Miter;
            Syncfusion.Windows.Forms.Diagram.Label label3 = new Syncfusion.Windows.Forms.Diagram.Label();
            label3.Text             = "Decision";
            label3.FontStyle.Family = "Arial";
            decision.Labels.Add(label3);
            decision.PinPoint = new PointF(550, 250);
            diagram1.Model.AppendChild(decision);
            OrthogonalConnector link2 = new OrthogonalConnector(decision.PinPoint, process.PinPoint);

            link2.LineStyle.LineColor = Color.Black;
            link2.LineStyle.LineWidth = 2f;
            diagram1.Model.AppendChild(link2);
            link2.TailDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
            link2.TailDecorator.Size                = new SizeF(8, 8);
            link2.TailDecorator.FillStyle.Color     = Color.Black;
            link2.TailDecorator.LineStyle.LineColor = Color.Black;
            decision.CentralPort.TryConnect(link2.TailEndPoint);
            process.CentralPort.TryConnect(link2.HeadEndPoint);
            Syncfusion.Windows.Forms.Diagram.Rectangle process2 = new Syncfusion.Windows.Forms.Diagram.Rectangle(500, 325, 100, 70);
            process2.FillStyle.Type      = FillStyleType.LinearGradient;
            process2.FillStyle.Color     = Color.FromArgb(51, 153, 255);
            process2.FillStyle.ForeColor = Color.FromArgb(51, 153, 255);
            process2.LineStyle.LineColor = Color.Black;
            process2.LineStyle.LineWidth = 2.0f;
            process2.LineStyle.LineJoin  = LineJoin.Miter;
            Syncfusion.Windows.Forms.Diagram.Label label4 = new Syncfusion.Windows.Forms.Diagram.Label();
            label4.Text             = "Process2";
            label4.FontStyle.Family = "Arial";
            process2.Labels.Add(label4);
            diagram1.Model.AppendChild(process2);
            diagram1.Model.AppendChild(decision); OrthogonalConnector link3 = new OrthogonalConnector(decision.PinPoint, process2.PinPoint);
            link3.LineStyle.LineColor = Color.Black;
            link3.LineStyle.LineWidth = 2f;
            diagram1.Model.AppendChild(link3);
            link3.TailDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
            link3.TailDecorator.Size                = new SizeF(8, 8);
            link3.TailDecorator.FillStyle.Color     = Color.Black;
            link3.TailDecorator.LineStyle.LineColor = Color.Black;
            decision.CentralPort.TryConnect(link3.HeadEndPoint);
            process2.CentralPort.TryConnect(link3.TailEndPoint);
            Syncfusion.Windows.Forms.Diagram.Ellipse ellipse2 = new Syncfusion.Windows.Forms.Diagram.Ellipse(495, 420, 110, 70);
            ellipse2.FillStyle.Type      = FillStyleType.LinearGradient;
            ellipse2.FillStyle.Color     = Color.FromArgb(51, 153, 255);
            ellipse2.FillStyle.ForeColor = Color.FromArgb(51, 153, 255);
            ellipse2.LineStyle.LineColor = Color.Black;
            ellipse2.LineStyle.LineWidth = 2.0f;
            ellipse2.LineStyle.LineJoin  = LineJoin.Miter;
            Syncfusion.Windows.Forms.Diagram.Label label5 = new Syncfusion.Windows.Forms.Diagram.Label();
            label5.Text             = "End";
            label5.FontStyle.Family = "Arial";
            ellipse2.Labels.Add(label5);
            diagram1.Model.AppendChild(ellipse2);
            diagram1.Model.AppendChild(decision); OrthogonalConnector link4 = new OrthogonalConnector(process2.PinPoint, ellipse2.PinPoint);
            link4.LineStyle.LineColor = Color.Black;
            link4.LineStyle.LineWidth = 2f;
            diagram1.Model.AppendChild(link4);
            link4.HeadDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
            link4.HeadDecorator.Size                = new SizeF(8, 8);
            link4.HeadDecorator.FillStyle.Color     = Color.Black;
            link4.HeadDecorator.LineStyle.LineColor = Color.Black;

            ellipse2.CentralPort.TryConnect(link4.HeadEndPoint);
            process2.CentralPort.TryConnect(link4.TailEndPoint);
            this.diagram1.Model.HistoryManager.Resume();
            diagram1.View.SelectionList.Clear();
        }
Esempio n. 7
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(100, 100, 100, 70);
            rect.FillStyle.Color     = Color.Maroon;
            rect.FillStyle.ForeColor = Color.Red;
            rect.FillStyle.Type      = FillStyleType.LinearGradient;
            rect.LineStyle.LineWidth = 0;
            Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(rect, "Top Left");
            lbl.FontColorStyle.Color = Color.White;
            lbl.Position             = Position.TopLeft;
            lbl.UpdatePosition       = true;
            rect.Labels.Add(lbl);
            diagram1.Model.AppendChild(rect);

            Syncfusion.Windows.Forms.Diagram.Rectangle rect1 = new Syncfusion.Windows.Forms.Diagram.Rectangle(350, 250, 100, 70);
            rect1.FillStyle.Color     = Color.Maroon;
            rect1.FillStyle.ForeColor = Color.Red;
            rect1.FillStyle.Type      = FillStyleType.LinearGradient;
            rect1.LineStyle.LineWidth = 0;
            Syncfusion.Windows.Forms.Diagram.Label lbl1 = new Syncfusion.Windows.Forms.Diagram.Label(rect1, "MiddleRight");
            lbl1.FontColorStyle.Color = Color.White;
            lbl1.Position             = Position.MiddleRight;
            lbl1.UpdatePosition       = true;
            rect1.Labels.Add(lbl1);
            diagram1.Model.AppendChild(rect1);

            OrthogonalConnector ocon = new OrthogonalConnector(new PointF(100, 100), new PointF(200, 100), false);

            ocon.HeadDecorator.DecoratorShape  = DecoratorShape.Filled45Arrow;
            ocon.HeadDecorator.FillStyle.Color = Color.Black;
            rect.CentralPort.Connect(ocon.TailEndPoint);
            rect1.CentralPort.Connect(ocon.HeadEndPoint);
            diagram1.Model.AppendChild(ocon);
            Syncfusion.Windows.Forms.Diagram.Label conLbl = new Syncfusion.Windows.Forms.Diagram.Label(ocon, "BottomCenter");
            conLbl.UpdatePosition = true;
            conLbl.Position       = Position.BottomCenter;
            conLbl.OffsetX        = 100;
            conLbl.OffsetY        = ocon.BoundingRectangle.Height;
            conLbl.BackgroundStyle.ColorAlphaFactor = 255;
            ocon.Labels.Add(conLbl);


            OrthogonalConnector ocon1 = new OrthogonalConnector(PointF.Empty, new PointF(0, 1), true);

            ocon1.HeadDecorator.DecoratorShape  = DecoratorShape.Filled45Arrow;
            ocon1.HeadDecorator.FillStyle.Color = Color.Black;
            rect.CentralPort.Connect(ocon1.TailEndPoint);
            rect1.CentralPort.Connect(ocon1.HeadEndPoint);
            diagram1.Model.AppendChild(ocon1);
            Syncfusion.Windows.Forms.Diagram.Label conLbl1 = new Syncfusion.Windows.Forms.Diagram.Label(ocon1, "Top Center");
            conLbl1.UpdatePosition = true;
            conLbl1.Position       = Position.TopCenter;
            conLbl1.OffsetX        = 80;
            conLbl1.OffsetY        = 0;
            conLbl1.BackgroundStyle.ColorAlphaFactor = 255;
            ocon1.Labels.Add(conLbl1);

            propertyGrid1.SelectedObject  = ((PathNode)diagram1.View.SelectionList[0]).Labels[0];
            diagram1.View.BackgroundColor = Color.White;
            diagram1.View.SelectionList.Clear();
            diagram1.EventSink.NodeSelected += new NodeSelectedEventHandler(EventSink_NodeSelected);
        }
Esempio n. 8
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            DiagramAppearance();
            //MySymbol symb1 = new MySymbol();
            //this.diagram1.Model.AppendChild(symb1);

            Rectangle outerRect = new Rectangle(160, 100, 96, 72);

            outerRect.Name                  = "Rectangle";
            outerRect.FillStyle.Type        = FillStyleType.LinearGradient;
            outerRect.FillStyle.Color       = Color.FromArgb(51, 153, 255);
            outerRect.FillStyle.ForeColor   = Color.FromArgb(51, 153, 255);
            outerRect.EditStyle.AllowSelect = false;
            this.diagram1.Model.AppendChild(outerRect);
            Syncfusion.Windows.Forms.Diagram.Label label1 = new Syncfusion.Windows.Forms.Diagram.Label();
            label1.Text             = "Process";
            label1.FontStyle.Family = "Arial";
            outerRect.Labels.Add(label1);
            this.diagram1.Model.AppendChild(outerRect);
            Ellipse ellipse1 = new Ellipse(150, 5, 110, 70);

            ellipse1.FillStyle.Color     = Color.FromArgb(51, 153, 255);
            ellipse1.FillStyle.ForeColor = Color.FromArgb(51, 153, 255);
            this.diagram1.Model.AppendChild(ellipse1);
            Syncfusion.Windows.Forms.Diagram.Label label2 = new Syncfusion.Windows.Forms.Diagram.Label();
            label2.Text             = "Start";
            label2.FontStyle.Family = "Arial";
            ellipse1.Labels.Add(label2);
            OrthogonalConnector link1 = new OrthogonalConnector(ellipse1.PinPoint, outerRect.PinPoint);

            link1.LineStyle.LineColor = Color.Black;
            link1.LineStyle.LineWidth = 2f;
            diagram1.Model.AppendChild(link1);
            link1.HeadDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
            link1.HeadDecorator.Size                = new SizeF(8, 8);
            link1.HeadDecorator.FillStyle.Color     = Color.Black;
            link1.HeadDecorator.LineStyle.LineColor = Color.Black;
            ellipse1.CentralPort.TryConnect(link1.TailEndPoint);
            outerRect.CentralPort.TryConnect(link1.HeadEndPoint);


            Ellipse ellipse2 = new Ellipse(150, 200, 110, 70);

            ellipse2.FillStyle.Color     = Color.FromArgb(51, 153, 255);
            ellipse2.FillStyle.ForeColor = Color.FromArgb(51, 153, 255);
            this.diagram1.Model.AppendChild(ellipse2);
            Syncfusion.Windows.Forms.Diagram.Label label3 = new Syncfusion.Windows.Forms.Diagram.Label();
            label3.Text             = "End";
            label3.FontStyle.Family = "Arial";
            ellipse2.Labels.Add(label3);
            OrthogonalConnector link2 = new OrthogonalConnector(ellipse2.PinPoint, outerRect.PinPoint);

            link2.LineStyle.LineColor = Color.Black;
            link2.LineStyle.LineWidth = 2f;
            diagram1.Model.AppendChild(link2);
            link2.TailDecorator.DecoratorShape      = DecoratorShape.Filled45Arrow;
            link2.TailDecorator.Size                = new SizeF(8, 8);
            link2.TailDecorator.FillStyle.Color     = Color.Black;
            link2.TailDecorator.LineStyle.LineColor = Color.Black;
            outerRect.CentralPort.TryConnect(link2.HeadEndPoint);
            ellipse2.CentralPort.TryConnect(link2.TailEndPoint);
            diagram1.View.SelectionList.Clear();
        }