/// <summary> /// Connects the given nodes with an arrow /// </summary> /// <param name="parentNode">Parent Node</param> /// <param name="childNode">Child node</param> /// <param name="connectionColor">Connector Color</param> private void connectNodes(Syncfusion.Windows.Forms.Diagram.Node parentNode, Syncfusion.Windows.Forms.Diagram.Node childNode) { if (parentNode != null && childNode != null) { LineConnector lConnector = new LineConnector(PointF.Empty, new PointF(0, 1)); lConnector.HeadDecorator.DecoratorShape = DecoratorShape.Filled45Arrow; lConnector.HeadDecorator.FillStyle.Color = Color.Black; parentNode.CentralPort.TryConnect(lConnector.TailEndPoint); childNode.CentralPort.TryConnect(lConnector.HeadEndPoint); sfDecompositionDiagram.Model.AppendChild(lConnector); sfDecompositionDiagram.Model.SendToBack(lConnector); } }
/// <summary> /// Generates the inner level nodes /// </summary> /// <param name="parentRect">Parent Node</param> /// <param name="maxSubNodes">Maximum sub nodes</param> /// <param name="LevelColor">Node's Fill color</param> /// <param name="connectionColor">Node's fore color</param> /// <param name="n">nodes level count</param> private void generateInnerLevelNodes(Syncfusion.Windows.Forms.Diagram.Node parentRect, NodeDecorator curNode) { Syncfusion.Windows.Forms.Diagram.Rectangle childRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 120, 80); childRect.FillStyle.Color = Color.FromArgb(242, 242, 242); childRect.FillStyle.Type = FillStyleType.LinearGradient; childRect.FillStyle.ForeColor = curNode.DrawColor; sfDecompositionDiagram.Model.AppendChild(childRect); Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(childRect, getNodeText(curNode)); label.FontStyle.Family = "Segoe UI"; label.FontStyle.Size = 10; label.FontColorStyle.Color = Color.Black; childRect.Labels.Add(label); connectNodes(parentRect, childRect); //recursively populate children foreach (var neighbor in myTask.Decomposition.GetNeighbors(curNode.NodeIndex)) { generateInnerLevelNodes(childRect, nodes[neighbor.NodeIndex]); } }