/// <summary> /// Initialize the nodes in daigram /// </summary> private void PopulateFields(DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { Syncfusion.Windows.Forms.Diagram.RoundRect rect = new Syncfusion.Windows.Forms.Diagram.RoundRect(0, 0, 120, 60, MeasureUnits.Pixel); rect.FillStyle.Color = Color.FromArgb(255, 86, 4); rect.FillStyle.ForeColor = Color.FromArgb(255, 165, 74); rect.LineStyle.LineColor = Color.White; rect.FillStyle.Type = FillStyleType.LinearGradient; //rect.EnableShading = true; rect.Name = dt.Rows[i]["Name"].ToString(); Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(rect, dt.Rows[i]["Name"].ToString()); label.FontStyle.Family = "Segoe UI"; label.FontStyle.Size = 9; label.FontColorStyle.Color = Color.White; rect.Labels.Add(label); Syncfusion.Windows.Forms.Diagram.Label label1 = new Syncfusion.Windows.Forms.Diagram.Label(rect, dt.Rows[i]["Designation"].ToString()); label1.FontStyle.Family = "Segoe UI"; label1.FontStyle.Size = 9; label1.FontColorStyle.Color = Color.White; label1.OffsetX = rect.BoundingRectangle.Width / 2 - label1.Size.Width / 2; label1.OffsetY = rect.BoundingRectangle.Height / 2 + 5; rect.Labels.Add(label1); diagram1.Model.AppendChild(rect); if (!string.IsNullOrEmpty(dt.Rows[i]["ParentName"].ToString())) { Syncfusion.Windows.Forms.Diagram.RoundRect parentNode = diagram1.Model.Nodes.FindNodeByName(dt.Rows[i]["ParentName"].ToString()) as Syncfusion.Windows.Forms.Diagram.RoundRect; string ss = parentNode.Name; ConnectNodes(parentNode, rect); } } }
/// <summary> /// Initialize the nodes in daigram /// </summary> private void PopulateFields(DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 80, 50); rect.FillStyle.Color = Color.FromArgb(159, 80, 0); rect.FillStyle.ForeColor = Color.FromArgb(255, 149, 149); rect.FillStyle.Type = FillStyleType.LinearGradient; rect.LineStyle.LineColor = Color.White; //rect.EnableShading = true; rect.Name = "Node" + dt.Rows[i]["ID"].ToString(); Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(rect, dt.Rows[i]["Title"].ToString()); label.FontStyle.Family = "Verdana"; label.FontStyle.Size = 8; label.FontColorStyle.Color = Color.White; rect.Labels.Add(label); diagram1.Model.AppendChild(rect); if (!string.IsNullOrEmpty(dt.Rows[i]["ParentID"].ToString())) { Syncfusion.Windows.Forms.Diagram.Rectangle parentNode = diagram1.Model.Nodes.FindNodeByName("Node" + dt.Rows[i]["ParentID"].ToString()) as Syncfusion.Windows.Forms.Diagram.Rectangle; string ss = parentNode.Name; ConnectNodes(parentNode, rect); } } }
/// <summary> /// Initialize the nodes in daigram /// </summary> private void populateNodes() { //get the root rode FlowTask_Backend.Node root = nodes[0]; //first level of nodes Syncfusion.Windows.Forms.Diagram.Rectangle rootRectangle = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 120, 80); rootRectangle.FillStyle.Color = Color.FromArgb(242, 242, 242); rootRectangle.FillStyle.Type = FillStyleType.LinearGradient; rootRectangle.FillStyle.ForeColor = Color.White; //give it a label with the node text Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(rootRectangle, getNodeText(root)); label.FontStyle.Family = "Segoe UI"; label.FontStyle.Size = 10; label.FontColorStyle.Color = Color.Black; rootRectangle.Labels.Add(label); sfDecompositionDiagram.Model.AppendChild(rootRectangle); //recursively populate children foreach (var neighbor in myTask.Decomposition.GetNeighbors(root.NodeIndex)) { generateInnerLevelNodes(rootRectangle, nodes[neighbor.NodeIndex]); } }
/// <summary> /// Adds the label to the given Node. /// </summary> /// <param name="pathNode">Node</param> private static void AddLabel(Syncfusion.Windows.Forms.Diagram.PathNode pathNode) { Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(pathNode, pathNode.Name); label.FontColorStyle.Color = Color.Black; label.FontStyle.Family = "Segoe UI"; pathNode.Labels.Add(label); }
/// <summary> /// Adds the Label to the given node /// </summary> /// <param name="rect1">Node</param> /// <param name="Text">Label's text</param> private static void AddLabel(Syncfusion.Windows.Forms.Diagram.Rectangle rect1, string Text) { Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(rect1, Text); label.FontStyle.Family = "Segoe UI"; // label.FontStyle.Size = 8; label.FontColorStyle.Color = Color.Black; rect1.Labels.Add(label); }
/// <summary> /// Adds the label to the given node. /// </summary> /// <param name="Text">Label's text</param> /// <param name="node">Node</param> private void AddLabel(string Text, PathNode node) { Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(node, Text); label.Position = Position.Center; label.FontStyle.Size = 9; label.FontStyle.Family = "verdana"; node.Labels.Add(label); }
/// <summary> /// Adds the label to the given node /// </summary> /// <param name="rect">Node</param> /// <param name="labelText">Label's Text</param> /// <param name="position">Label's position</param> private static void AddLabel(Syncfusion.Windows.Forms.Diagram.PathNode rect, string labelText, Position position) { Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(rect, labelText); label.Position = position; label.UpdatePosition = true; label.FontStyle.Family = "Segoe UI"; label.FontColorStyle.Color = Color.Black; label.FontStyle.Size = 9; rect.Labels.Add(label); }
/// <summary> /// New function for adding label to the Rectangle /// </summary> /// <param name="rect">Container of the Label</param> /// <param name="labelText">Text of the Label</param> /// <returns></returns> private static Syncfusion.Windows.Forms.Diagram.Label AddLabel(Syncfusion.Windows.Forms.Diagram.RoundRect rect, string labelText) { Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(rect, labelText); label.FontStyle.Family = "Verdana"; label.FontStyle.Size = 8; label.FontColorStyle.Color = Color.White; label.HorizontalAlignment = StringAlignment.Center; label.VerticalAlignment = StringAlignment.Center; return(label); }
public DataSymbol(ArrayList strColumnName, string strTableName, string primaryKey) : base() { this.Name = strTableName; float rectHeight = (strColumnName.Count * 20) + 40; Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 150, rectHeight); rect.FillStyle.Color = Color.WhiteSmoke; rect.Name = "BaseNode"; Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(rect, strTableName); lbl.FontStyle.Family = "Arial"; lbl.FontStyle.Size = 9; lbl.FontStyle.Bold = true; lbl.Position = Position.TopLeft; lbl.OffsetX = 65; lbl.OffsetY = 18; lbl.UpdatePosition = true; rect.Labels.Add(lbl); this.AppendChild(rect); float z = 30; for (int i = 0; i < strColumnName.Count; i++) { TextNode txtNode = new TextNode(strColumnName[i].ToString(), new RectangleF(30, z, 110, 20)); txtNode.FontStyle.Family = "Arial"; txtNode.FontStyle.Size = 7; txtNode.VerticalAlignment = StringAlignment.Center; txtNode.BackgroundStyle.Color = Color.White; txtNode.LineStyle.LineColor = Color.LightGray; Syncfusion.Windows.Forms.Diagram.Rectangle symRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(10, z, 20, 20); symRect.FillStyle.Color = Color.WhiteSmoke; symRect.FillStyle.Type = FillStyleType.LinearGradient; symRect.LineStyle.LineColor = Color.LightGray; symRect.EditStyle.AllowSelect = false; this.AppendChild(txtNode); this.AppendChild(symRect); if (primaryKey == txtNode.Text) { #if !NETCORE Bitmap bmp = new Bitmap(@"..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\key.png"); #else Bitmap bmp = new Bitmap(@"..\..\..\..\..\..\..\..\Common\Images\Diagram\class diagram\key.png"); #endif BitmapNode bmpNode = new BitmapNode(bmp, new RectangleF(symRect.BoundingRectangle.X + 5, symRect.BoundingRectangle.Y + 5, symRect.BoundingRectangle.Width - 10, symRect.BoundingRectangle.Height - 10)); bmpNode.LineStyle.LineColor = Color.Transparent; bmpNode.EditStyle.AllowSelect = false; this.AppendChild(bmpNode); } z = z + 20; } }
private void Form1_Load(object sender, EventArgs e) { Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(10, 10, 100, 50); Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(); label.FontColorStyle.Color = Color.White; label.FontStyle.Family = "Segoe UI"; rect.Labels.Add(label); rect.FillStyle.Color = System.Drawing.Color.FromArgb(116, 160, 47); DataTable table = diagram1.GetDataSourceFromXML(@"..\..\..\..\..\..\..\Common\Data\Diagram\xml\XML Binding1.xml"); this.diagram1.Binding.DefaultNode = rect; this.diagram1.Binding.Label.Add("Name"); this.diagram1.Binding.ParentId = "ManagerID"; this.diagram1.Binding.Id = "EmployeeID"; this.diagram1.Binding.DataSource = table; }
public EllipseRectGroup(int number, string header, string content, Color HeaderColor, Color ContentColor, Color HeaderBackColor, Color ContentBackColor) { RectangleF rect = new RectangleF(55, 3, 290, 45); TextNode nodeRectHeader = new TextNode(header, rect); nodeRectHeader.BackgroundStyle.Color = HeaderBackColor; nodeRectHeader.LineStyle.LineWidth = 0; nodeRectHeader.FontStyle.Size = 14; nodeRectHeader.FontStyle.Bold = false; nodeRectHeader.FontStyle.Italic = true; nodeRectHeader.FontColorStyle.Color = HeaderColor; nodeRectHeader.ReadOnly = true; nodeRectHeader.HorizontalAlignment = StringAlignment.Near; nodeRectHeader.VerticalAlignment = StringAlignment.Center; rect = new RectangleF(0, 50, 350, 90); TextNode nodeRectContent = new TextNode(content, rect); nodeRectContent.BackgroundStyle.Color = ContentBackColor; nodeRectContent.LineStyle.LineWidth = 1; nodeRectContent.FontStyle.Size = 11; nodeRectContent.FontStyle.Bold = false; nodeRectContent.FontColorStyle.Color = ContentColor; nodeRectContent.ReadOnly = true; Syncfusion.Windows.Forms.Diagram.Ellipse numberEllipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(5, 3, 35, 35); numberEllipse.FillStyle.Color = Color.White; Syncfusion.Windows.Forms.Diagram.Label lble = new Syncfusion.Windows.Forms.Diagram.Label(); lble.Text = number.ToString(); lble.SizeToNode = true; lble.Position = Position.Center; lble.FontStyle.Size = 12; lble.FontStyle.Bold = true; numberEllipse.Labels.Add(lble); Syncfusion.Windows.Forms.Diagram.Rectangle nodeRectBorder = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 350, 50); nodeRectBorder.FillStyle.Color = Color.LightBlue; nodeRectBorder.LineStyle.LineWidth = 1; this.AppendChild(nodeRectBorder); this.AppendChild(numberEllipse); this.AppendChild(nodeRectHeader); this.AppendChild(nodeRectContent); this.EditStyle.AllowSelect = false; }
/// <summary> /// Generates the diagram from the data source. /// </summary> /// <param name="dt">Data Source to be passed</param> private void PopulateFields(DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { Syncfusion.Windows.Forms.Diagram.RoundRect rect = GetRoundRect(); rect.Name = "Node" + dt.Rows[i]["ID"].ToString(); string labelText = dt.Rows[i]["Title"].ToString() + "\r\n" + dt.Rows[i]["Designation"].ToString(); // create a new label for roundrect Syncfusion.Windows.Forms.Diagram.Label label = AddLabel(rect, labelText); rect.Labels.Add(label); diagram1.Model.AppendChild(rect); if (!string.IsNullOrEmpty(dt.Rows[i]["ParentID"].ToString())) { Syncfusion.Windows.Forms.Diagram.RoundRect parentNode = diagram1.Model.Nodes.FindNodeByName("Node" + dt.Rows[i]["ParentID"].ToString()) as Syncfusion.Windows.Forms.Diagram.RoundRect; string ss = parentNode.Name; ConnectNodes(parentNode, rect); } } }
/// <summary> /// Iterative sub-employee symbol node creation /// </summary> /// <param name="emply">List Employees in the XML file</param> protected void IterCreateEmployeeSymbol(List <XMLBindinglist> emply) { foreach (XMLBindinglist subemply in emply) { Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(200, 0, 150, 60); rect.Name = subemply.EmployeeID; rect.FillStyle.Color = System.Drawing.Color.FromArgb(240, 242, 240); rect.FillStyle.ForeColor = System.Drawing.Color.White; rect.FillStyle.Type = FillStyleType.LinearGradient; rect.LineStyle.LineColor = System.Drawing.Color.Black; this.diagram1.Model.AppendChild(rect); Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(); label.Container = rect; label.Text = subemply.EmployeeName; label.Position = Position.Center; label.FontStyle.Family = "Segoe UI"; label.FontStyle.Size = 8; rect.Labels.Add(label); if (!string.IsNullOrEmpty(subemply.ManagerID)) { //OrthogonalConnector conn = new OrthogonalConnector(PointF.Empty, new PointF(0, 1)); OrgLineConnector conn = new OrgLineConnector(System.Drawing.PointF.Empty, new System.Drawing.PointF(0, 1), MeasureUnits.Pixel); conn.LineStyle.LineColor = System.Drawing.Color.Black; Decorator decor = conn.HeadDecorator; decor.DecoratorShape = DecoratorShape.Filled45Arrow; decor.Size = new System.Drawing.SizeF(10, 10); decor.FillStyle.Color = System.Drawing.Color.Black; decor.LineStyle.LineColor = System.Drawing.Color.Black; conn.VerticalDistance = 50; Syncfusion.Windows.Forms.Diagram.Rectangle rect1 = diagram1.Model.Nodes.FindNodeByName(subemply.ManagerID) as Syncfusion.Windows.Forms.Diagram.Rectangle; rect1.CentralPort.TryConnect(conn.TailEndPoint); rect.CentralPort.TryConnect(conn.HeadEndPoint); this.diagram1.Model.AppendChild(conn); // this.diagram1.Model.BringToFront(rect1); } //orgLayoutMgr.Nodes.Clear(); //orgLayoutMgr.Nodes.AddRange(this.diagram1.Model.Nodes); //orgLayoutMgr.UpdateLayout(null); } }
/// <summary> /// Insert the node from palette /// </summary> /// <param name="name">Node name</param> /// <param name="ptPinPoint">Node location</param> /// <param name="label">Label's text</param> /// <param name="nodeSize">Node size</param> /// <returns>returns the node</returns> private Node InsertNodeFromPallete(string name, PointF ptPinPoint, string label, SizeF nodeSize) { Node node = null; NodeCollection nodes = paletteGroupBar1.CurrentSymbolPalette.Nodes; if (name != null) { node = (Node)nodes[name].Clone(); InsertNode(node, ptPinPoint); } //Set Node's size node.Size = nodeSize; //Add labels to node lbl = new Syncfusion.Windows.Forms.Diagram.Label(node, label); lbl.FontStyle.Family = "Arial"; ((PathNode)node).Labels.Add(lbl); return(node); }
/// <summary> /// Connects the given nodes /// </summary> /// <param name="parentNode">Parent Node</param> /// <param name="childNode">Child node</param> /// <param name="connectionColor">Connector Color</param> private void ConnectNodes(Node parentNode, Node childNode, Color connectionColor) { if (parentNode != null && childNode != null) { LineConnector lConnector = new LineConnector(PointF.Empty, new PointF(0, 1)); lConnector.HeadDecorator.DecoratorShape = DecoratorShape.None; lConnector.LineStyle.LineColor = connectionColor; lConnector.HeadDecorator.FillStyle.Color = connectionColor; lConnector.HeadDecorator.LineStyle.LineColor = connectionColor; lConnector.HeadDecorator.Size = new SizeF(10, 10); lConnector.CentralPort.ConnectionsLimit = 10000; Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(lConnector, diagram1.Model.Nodes.Count.ToString()); label.Visible = false; lConnector.Labels.Add(label); parentNode.CentralPort.TryConnect(lConnector.TailEndPoint); childNode.CentralPort.TryConnect(lConnector.HeadEndPoint); this.diagram1.Model.AppendChild(lConnector); this.diagram1.Model.SendToBack(lConnector); } }
public ContentWithOuterRectangle(string content, string tip, Color BackColor, Color tipBackColor) { Syncfusion.Windows.Forms.Diagram.Rectangle ContentEmpty = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 200, 10, units); ContentEmpty.FillStyle.Color = Color.Transparent; ContentEmpty.LineStyle.LineWidth = 0; RectangleF rect = new RectangleF(0, 15, 200, 45); TextNode nodeRectHeader = new TextNode(content, rect); nodeRectHeader.EnableCentralPort = false; nodeRectHeader.BackgroundStyle.Color = BackColor; nodeRectHeader.BackgroundStyle.Color = Color.White; nodeRectHeader.LineStyle.LineWidth = 1; nodeRectHeader.FontStyle.Size = 10; nodeRectHeader.ReadOnly = true; nodeRectHeader.HorizontalAlignment = StringAlignment.Near; nodeRectHeader.VerticalAlignment = StringAlignment.Near; Syncfusion.Windows.Forms.Diagram.RoundRect roundrect = new Syncfusion.Windows.Forms.Diagram.RoundRect(ContentEmpty.Size.Width - 20, 0, 40, 15, units); roundrect.EnableCentralPort = false; // Add an outer RoundRectangle. roundrect.FillStyle.ForeColor = System.Drawing.Color.SkyBlue; roundrect.LineStyle.LineColor = Color.FromArgb(253, 188, 140); roundrect.FillStyle.Color = tipBackColor; roundrect.EnableShading = false; Syncfusion.Windows.Forms.Diagram.Label lblr = new Syncfusion.Windows.Forms.Diagram.Label(); lblr.Text = tip; lblr.SizeToNode = true; lblr.Position = Position.Center; lblr.FontStyle.Size = 14; lblr.FontStyle.Bold = true; roundrect.Labels.Add(lblr); this.EnableCentralPort = true; ContentEmpty.EnableCentralPort = true; roundrect.EnableCentralPort = true; this.AppendChild(ContentEmpty); this.AppendChild(nodeRectHeader); this.AppendChild(roundrect); this.EditStyle.AllowSelect = false; }
/// <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]); } }
/// <summary> /// Create the new member with specified name and title. /// </summary> /// <param name="strMemberName">The member name.</param> /// <param name="strTitle">The title.</param> private Node CreateMember(string strMemberName, string strTitle) { SizeF szSize = new SizeF(140, 60); Syncfusion.Windows.Forms.Diagram.RoundRect rnRect = new Syncfusion.Windows.Forms.Diagram.RoundRect(0, 0, 120, 60, MeasureUnits.Pixel); rnRect.FillStyle.Color = Color.FromArgb(255, 86, 4); rnRect.FillStyle.ForeColor = Color.FromArgb(255, 165, 74); rnRect.LineStyle.LineColor = Color.White; rnRect.FillStyle.Type = FillStyleType.LinearGradient; Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(rnRect, strMemberName); label.FontStyle.Family = "Segoe UI"; label.FontStyle.Size = 9; label.FontColorStyle.Color = Color.White; rnRect.Labels.Add(label); Syncfusion.Windows.Forms.Diagram.Label label1 = new Syncfusion.Windows.Forms.Diagram.Label(rnRect, strTitle); label1.FontStyle.Family = "Segoe UI"; label1.FontStyle.Size = 9; label1.FontColorStyle.Color = Color.White; label1.OffsetX = rnRect.BoundingRectangle.Width / 2 - label1.Size.Width / 2; label1.OffsetY = rnRect.BoundingRectangle.Height / 2 + 5; rnRect.Labels.Add(label1); return(rnRect); }
public HeaderandEllipse(int number, string content, Color ContentColor, Color Background, int fontsize) { RectangleF rect = new RectangleF(55, 3, 140, 45); TextNode txtContent = new TextNode(content, rect); txtContent.BackgroundStyle.Color = Color.LightBlue; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = fontsize; txtContent.FontStyle.Bold = true; txtContent.FontStyle.Italic = true; txtContent.FontColorStyle.Color = ContentColor; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; Syncfusion.Windows.Forms.Diagram.Ellipse numberEllipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(5, 3, 35, 35); numberEllipse.FillStyle.Color = Color.White; Syncfusion.Windows.Forms.Diagram.Label lble = new Syncfusion.Windows.Forms.Diagram.Label(); lble.Text = number.ToString(); lble.SizeToNode = true; lble.Position = Position.Center; lble.FontStyle.Size = 12; lble.FontStyle.Bold = true; numberEllipse.Labels.Add(lble); Syncfusion.Windows.Forms.Diagram.Rectangle nodeRectBorder = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 200, 50); nodeRectBorder.FillStyle.Color = Background; nodeRectBorder.LineStyle.LineWidth = 1; //nodeRectBorder.EnableCentralPort = true; //numberEllipse.EnableCentralPort = true; //nodeRectHeader.EnableCentralPort = true; this.AppendChild(nodeRectBorder); this.AppendChild(numberEllipse); this.AppendChild(txtContent); this.EditStyle.AllowSelect = false; }
private void Form1_Load(object sender, EventArgs e) { diagram1.Model.RenderingStyle.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(100, 50, 100, 75); rect.FillStyle.Color = Color.FromArgb(242, 242, 242); rect.FillStyle.ForeColor = Color.White; rect.FillStyle.Type = FillStyleType.LinearGradient; rect.LineStyle.LineWidth = 1; AddLabel(rect); Syncfusion.Windows.Forms.Diagram.RoundRect roundRect = new Syncfusion.Windows.Forms.Diagram.RoundRect(220, 0, 100, 75, MeasureUnits.Pixel); roundRect.FillStyle.Color = Color.FromArgb(242, 242, 242); roundRect.FillStyle.ForeColor = Color.White; roundRect.FillStyle.Type = FillStyleType.LinearGradient; roundRect.LineStyle.LineWidth = 1; AddLabel(roundRect); Ellipse ellipse1 = new Ellipse(100, 200, 100, 80); ellipse1.Name = "Start/Stop"; ellipse1.FillStyle.Color = Color.FromArgb(242, 242, 242); ellipse1.FillStyle.ForeColor = Color.White; ellipse1.FillStyle.Type = FillStyleType.LinearGradient; ellipse1.LineStyle.LineWidth = 1; AddLabel(ellipse1); diagram1.Model.AppendChild(ellipse1); Polygon poly = new Polygon(new PointF[] { new PointF(15, 0), new PointF(0, 45), new PointF(15, 90), new PointF(60, 90), new PointF(75, 45), new PointF(60, 0) }); poly = new Polygon(new PointF[] { new PointF(45, 0), new PointF(0, 45), new PointF(45, 90), new PointF(90, 45) }); poly.Name = "Decision"; poly.PinPoint = new PointF(350, 230); poly.FillStyle.Color = Color.FromArgb(242, 242, 242); poly.FillStyle.ForeColor = Color.White; poly.FillStyle.Type = FillStyleType.LinearGradient; poly.LineStyle.LineWidth = 1; AddLabel(poly); diagram1.Model.AppendChild(poly); Syncfusion.Windows.Forms.Diagram.Rectangle rect1 = new Syncfusion.Windows.Forms.Diagram.Rectangle(100, 350, 100, 75); rect1.Name = "Process"; rect1.FillStyle.Color = Color.FromArgb(242, 242, 242); rect1.FillStyle.ForeColor = Color.White; rect1.FillStyle.Type = FillStyleType.LinearGradient; rect1.LineStyle.LineWidth = 1; AddLabel(rect1); diagram1.Model.AppendChild(rect1); Group group = new Group(); group.AppendChild(rect); group.AppendChild(roundRect); diagram1.Model.AppendChild(group); Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(); label.Container = group; label.Text = "Group1"; label.FontStyle.Family = "Segoe UI"; label.FontStyle.Size = 9; group.Labels.Add(label); diagram1.View.BackgroundColor = Color.White; diagram1.View.SelectionList.Clear(); this.diagram1.MouseDown += new MouseEventHandler(diagram1_MouseDown); this.diagram1.MouseUp += new MouseEventHandler(diagram1_MouseUp); // Wire up OnIdle processing Application.Idle += new EventHandler(Application_Idle); }
public GridSymbols(string[] plan, string[] actual, string tip) { int x = 0; for (int i = 0; i < 12; i++) { Syncfusion.Windows.Forms.Diagram.Rectangle numRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(x, 0, 20, 25f); numRect.FillStyle.Color = Color.White; this.AppendChild(numRect); switch (plan[i]) { case "P-0": SymbolDoubleRect symbol = new SymbolDoubleRect(); symbol.PinPoint = new PointF(x + symbol.BoundingRectangle.Width / 2 + 2.5f, symbol.BoundingRectangle.Height / 2 + 2.5f); this.AppendChild(symbol); break; case "P-1": Polygon triangle = getTriangle(); triangle.PinPoint = new PointF(x + triangle.BoundingRectangle.Width / 2, triangle.BoundingRectangle.Height / 2 + 5f); this.AppendChild(triangle); break; case "P-2": PolylineNode poly = getPolyLine(); poly.PinPoint = new PointF(x + poly.BoundingRectangle.Width / 2, poly.BoundingRectangle.Height / 2 + 2.5f); this.AppendChild(poly); break; case "P-3": SymbolDoubleEllipse dcircle = new SymbolDoubleEllipse(); dcircle.PinPoint = new PointF(x + dcircle.BoundingRectangle.Width / 2, dcircle.BoundingRectangle.Height / 2 + 2.5f); this.AppendChild(dcircle); break; case "P-4": Polygon star = getStar(); star.PinPoint = new PointF(x + star.BoundingRectangle.Width / 2, star.BoundingRectangle.Height / 2 + 2.5f); this.AppendChild(star); break; } x += 20; } x = 0; for (int i = 0; i < 12; i++) { Syncfusion.Windows.Forms.Diagram.Rectangle numRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(x, 25f, 20, 25f); numRect.FillStyle.Color = Color.White; this.AppendChild(numRect); switch (actual[i]) { case "A-0": Ellipse green = getEllipse(x + 3, -45f, Color.Green); this.AppendChild(green); break; case "A-1": Ellipse yellow = getEllipse(x + 3, -45f, Color.Yellow); this.AppendChild(yellow); break; case "A-2": Ellipse red = getEllipse(x + 3, -45f, Color.Red); this.AppendChild(red); break; case "A-3": Ellipse blue = getEllipse(x + 3, -45f, Color.Blue); this.AppendChild(blue); break; } x += 20; } Syncfusion.Windows.Forms.Diagram.Rectangle HeadContent = new Syncfusion.Windows.Forms.Diagram.Rectangle(100, -4, 100, 8); HeadContent.FillStyle.Color = Color.LightYellow; Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(); lbl.Text = tip; lbl.SizeToNode = true; lbl.Position = Position.Center; lbl.FontStyle.Size = 10; HeadContent.Labels.Add(lbl); this.AppendChild(HeadContent); this.EditStyle.AllowSelect = false; }
private void InitializeDiagram(SymbolPalette palette) { float x = 150; float y = 150; int rowNodeCnt = 1, j = 0; string[] strRow = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; TextNode txtNode = new TextNode("View and Change Seats", new RectangleF(250, 20, 400, 70)); txtNode.FontColorStyle.Color = Color.White; txtNode.FontStyle.Family = "Arial"; txtNode.FontStyle.Size = 17; txtNode.HorizontalAlignment = StringAlignment.Center; txtNode.FontStyle.Bold = true; txtNode.LineStyle.LineColor = Color.Transparent; txtNode.EditStyle.AllowSelect = false; diagram1.Model.AppendChild(txtNode); Group availSeats = new Group(palette.Nodes["Seat"] as Group); availSeats.Name = "availSeats"; availSeats.PinPoint = new PointF(250, 80); availSeats.Size = new SizeF(20, 20); availSeats.EditStyle.AllowMoveX = false; availSeats.EditStyle.AllowMoveY = false; UpdateEditStyle(availSeats); diagram1.Model.AppendChild(availSeats); TextNode availTNode = new TextNode("Available Seats", new RectangleF(265, 70, 90, 20)); availTNode.FontStyle.Family = "Arial"; availTNode.FontColorStyle.Color = Color.White; availTNode.FontStyle.Size = 8; availTNode.VerticalAlignment = StringAlignment.Center; availTNode.LineStyle.LineColor = Color.Transparent; availTNode.EditStyle.AllowSelect = false; diagram1.Model.AppendChild(availTNode); Group bookedSeats = new Group(palette.Nodes["Seat"] as Group); bookedSeats.Name = "bookedSeats"; bookedSeats.PinPoint = new PointF(380, 80); bookedSeats.Size = new SizeF(20, 20); bookedSeats.EditStyle.AllowMoveX = false; bookedSeats.EditStyle.AllowMoveY = false; UpdateEditStyle(bookedSeats); foreach (Node node in bookedSeats.Nodes) { if (node is FilledPath) { ((FilledPath)node).FillStyle.Color = Color.FromArgb(134, 134, 134); ((FilledPath)node).FillStyle.ForeColor = Color.FromArgb(163, 163, 163); node.LineStyle.LineColor = Color.DarkGray; } } diagram1.Model.AppendChild(bookedSeats); TextNode bookedTNode = new TextNode("Booked Seats", new RectangleF(395, 70, 90, 20)); bookedTNode.FontStyle.Family = "Arial"; bookedTNode.FontColorStyle.Color = Color.White; bookedTNode.FontStyle.Size = 8; bookedTNode.VerticalAlignment = StringAlignment.Center; bookedTNode.LineStyle.LineColor = Color.Transparent; bookedTNode.EditStyle.AllowSelect = false; diagram1.Model.AppendChild(bookedTNode); Group curSelSeats = new Group(palette.Nodes["Seat"] as Group); curSelSeats.PinPoint = new PointF(500, 80); curSelSeats.Size = new SizeF(20, 20); curSelSeats.EditStyle.AllowMoveX = false; curSelSeats.EditStyle.AllowMoveY = false; UpdateEditStyle(curSelSeats); foreach (Node node in curSelSeats.Nodes) { if (node is FilledPath) { ((FilledPath)node).FillStyle.Color = Color.FromArgb(0, 155, 0); ((FilledPath)node).FillStyle.ForeColor = Color.FromArgb(80, 255, 89); node.LineStyle.LineColor = Color.Black; } } diagram1.Model.AppendChild(curSelSeats); TextNode CurSelTNode = new TextNode("Current Selection", new RectangleF(515, 70, 90, 20)); CurSelTNode.FontStyle.Family = "Arial"; CurSelTNode.FontColorStyle.Color = Color.White; CurSelTNode.FontStyle.Size = 8; CurSelTNode.VerticalAlignment = StringAlignment.Center; CurSelTNode.LineStyle.LineColor = Color.Transparent; CurSelTNode.EditStyle.AllowSelect = false; diagram1.Model.AppendChild(CurSelTNode); for (int i = 1; i < 106; i++) { Group seatNode = new Group(palette.Nodes["Seat"] as Group); Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(seatNode, i.ToString()); lbl.FontStyle.Family = "Arial"; lbl.FontColorStyle.Color = Color.White; seatNode.Labels.Add(lbl); seatNode.Size = new SizeF(30, 30); seatNode.PinPoint = new PointF(x, y); seatNode.EditStyle.AllowMoveX = false; seatNode.EditStyle.AllowMoveY = false; UpdateEditStyle(seatNode); seatNode.EditStyle.DefaultHandleEditMode = HandleEditMode.None; diagram1.Model.AppendChild(seatNode); seats.Add(seatNode); if (rowNodeCnt == 10) { x = x + 80; } else { x = x + 40; } if (rowNodeCnt == 15) { Syncfusion.Windows.Forms.Diagram.Rectangle rowNode = new Syncfusion.Windows.Forms.Diagram.Rectangle(100, y - 10, 20, 20); rowNode.FillStyle.Color = Color.Goldenrod; rowNode.FillStyle.ForeColor = Color.Yellow; rowNode.FillStyle.Type = FillStyleType.LinearGradient; rowNode.LineStyle.LineColor = Color.Goldenrod; rowNode.EditStyle.AllowSelect = false; Syncfusion.Windows.Forms.Diagram.Label lbl1 = new Syncfusion.Windows.Forms.Diagram.Label(rowNode, strRow[j]); lbl1.FontStyle.Family = "Arial"; lbl1.FontColorStyle.Color = Color.Black; rowNode.Labels.Add(lbl1); diagram1.Model.AppendChild(rowNode); x = 150; y = y + 40; rowNodeCnt = 0; j++; } rowNodeCnt++; } Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(150, y + 40, 600, 50); rect.FillStyle.Color = Color.WhiteSmoke; rect.LineStyle.LineColor = Color.LightGray; Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(rect, "Screen this way"); label.FontStyle.Bold = true; label.FontStyle.Size = 16; label.FontStyle.Family = "Segoe UI"; rect.Labels.Add(label); diagram1.Model.AppendChild(rect); diagram1.BeginUpdate(); ReserveSeats(); diagram1.EndUpdate(); }
public HeaderRectangleActual() { Syncfusion.Windows.Forms.Diagram.Rectangle MainRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 200, 150); MainRect.FillStyle.Color = Color.White; MainRect.LineStyle.LineColor = Color.Black; Syncfusion.Windows.Forms.Diagram.Rectangle HeadContent = new Syncfusion.Windows.Forms.Diagram.Rectangle(MainRect.BoundingRectangle.Width / 2 - 50, -10, 100, 20); HeadContent.FillStyle.Color = Color.LightYellow; Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(); lbl.Text = "Actual"; lbl.SizeToNode = true; lbl.Position = Position.Center; lbl.FontStyle.Size = 12; lbl.FontStyle.Bold = true; HeadContent.Labels.Add(lbl); this.AppendChild(MainRect); this.AppendChild(HeadContent); Syncfusion.Windows.Forms.Diagram.Ellipse ellipse; ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(10, 40, 15, 15); ellipse.FillStyle.Color = Color.Green; RectangleF rect = new RectangleF(30, 35, 150, 25); TextNode txtContent = new TextNode("=OnSchedule", rect); txtContent.BackgroundStyle.Color = Color.Transparent; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = 10; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; this.AppendChild(txtContent); this.AppendChild(ellipse); ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(10, 70, 15, 15); ellipse.FillStyle.Color = Color.Yellow; rect = new RectangleF(30, 65, 150, 25); txtContent = new TextNode("=Behind Schedule", rect); txtContent.BackgroundStyle.Color = Color.Transparent; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = 10; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; this.AppendChild(txtContent); this.AppendChild(ellipse); ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(10, 100, 15, 15); ellipse.FillStyle.Color = Color.Red; rect = new RectangleF(30, 95, 150, 25); txtContent = new TextNode("=Critically Behind", rect); txtContent.BackgroundStyle.Color = Color.Transparent; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = 10; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; this.AppendChild(txtContent); this.AppendChild(ellipse); ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(10, 130, 15, 15); ellipse.FillStyle.Color = Color.Blue; rect = new RectangleF(30, 125, 120, 25); txtContent = new TextNode("=Complete", rect); txtContent.BackgroundStyle.Color = Color.Transparent; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = 10; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; this.AppendChild(txtContent); this.AppendChild(ellipse); this.EditStyle.AllowSelect = false; }
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(); }
/// <summary> /// initializes the Diagram data /// </summary> private void InitializeDiagram() { Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(100, 25, 120, 75); rect.FillStyle.Color = Color.FromArgb(240, 242, 240); rect.FillStyle.ForeColor = Color.White; rect.FillStyle.Type = FillStyleType.LinearGradient; rect.LineStyle.LineColor = Color.DarkGray; AddLabel(rect, "Rectangle", Position.Center); diagram1.Model.AppendChild(rect); Syncfusion.Windows.Forms.Diagram.RoundRect roundRect = new Syncfusion.Windows.Forms.Diagram.RoundRect(400, 25, 120, 75, MeasureUnits.Pixel); roundRect.FillStyle.Color = Color.FromArgb(240, 242, 240); roundRect.FillStyle.ForeColor = Color.White; roundRect.LineStyle.LineColor = Color.DarkGray; roundRect.FillStyle.Type = FillStyleType.LinearGradient; AddLabel(roundRect, "RoundRect1", Position.Center); diagram1.Model.AppendChild(roundRect); Ellipse ellipse1 = new Ellipse(100, 125, 120, 80); ellipse1.FillStyle.Color = Color.FromArgb(240, 242, 240); ellipse1.FillStyle.ForeColor = Color.White; ellipse1.LineStyle.LineColor = Color.DarkGray; ellipse1.FillStyle.Type = FillStyleType.LinearGradient; AddLabel(ellipse1, "Ellipse", Position.Center); diagram1.Model.AppendChild(ellipse1); Polygon poly = new Polygon(new PointF[] { new PointF(160, 235), new PointF(100, 265), new PointF(120, 325), new PointF(200, 325), new PointF(220, 265) }); poly.FillStyle.Color = Color.FromArgb(240, 242, 240); poly.FillStyle.ForeColor = Color.White; poly.FillStyle.Type = FillStyleType.LinearGradient; poly.LineStyle.LineColor = Color.DarkGray; AddLabel(poly, "Polygon", Position.Center); diagram1.Model.AppendChild(poly); SemiCircle semiCircle = new SemiCircle(400, 125, 120, 75); semiCircle.FillStyle.Color = Color.FromArgb(240, 242, 240); semiCircle.FillStyle.ForeColor = Color.White; semiCircle.FillStyle.Type = FillStyleType.LinearGradient; semiCircle.LineStyle.LineColor = Color.DarkGray; AddLabel(semiCircle, "SemiCircle", Position.Center); diagram1.Model.AppendChild(semiCircle); TextNode textNode = new TextNode("TextNode1", new RectangleF(400, 245, 120, 50)); textNode.FontStyle.Size = 9; textNode.FontStyle.Family = "Segoe UI"; textNode.HorizontalAlignment = StringAlignment.Center; textNode.VerticalAlignment = StringAlignment.Center; textNode.LineStyle.LineColor = Color.DarkGray; textNode.FontColorStyle.Color = Color.Black; diagram1.Model.AppendChild(textNode); RichTextNode richTextNode = new RichTextNode(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Meiryo UI;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}} {\colortbl ;\red255\green0\blue0;\red0\green64\blue128;} \viewkind4\uc1\pard\b\f0\fs17 This is a text symbol\f1 \b0\f0 designed using the \cf1\b\i Essential Diagram\i0 \cf2\ul RichText\ulnone node\cf0\b0 .\par \i\f1\fs20\par }", new RectangleF(400, 320, 120, 100)); richTextNode.LineStyle.LineColor = Color.DarkGray; diagram1.Model.AppendChild(richTextNode); #if !NETCORE BitmapNode bmpNode = new BitmapNode(@"..\..\..\..\..\..\common\Images\Diagram\OrgChart Layout\image3.png"); #else BitmapNode bmpNode = new BitmapNode(@"..\..\..\..\..\..\..\common\Images\Diagram\OrgChart Layout\image3.png"); #endif bmpNode.Name = "BitmapNode1"; bmpNode.PinPoint = new PointF(700, 75); bmpNode.Size = new SizeF(120, 100); bmpNode.LineStyle.LineWidth = 0; diagram1.Model.AppendChild(bmpNode); ClosedCurveNode curve = new ClosedCurveNode(new PointF[] { new PointF(120, 350), new PointF(120, 450), new PointF(220, 400) }); curve.FillStyle.Color = Color.FromArgb(240, 242, 240); curve.FillStyle.ForeColor = Color.White; curve.FillStyle.Type = FillStyleType.LinearGradient; curve.LineStyle.LineColor = Color.DarkGray; AddLabel(curve, "ClosedCurve", Position.Center); diagram1.Model.AppendChild(curve); CurveNode curve1 = new CurveNode(new PointF[] { new PointF(120, 100), new PointF(120, 200), new PointF(220, 150) }); curve1 = new CurveNode(new PointF[] { new PointF(0, 30), new PointF(4.99999952f, 25), new PointF(18.3333321f, 0), new PointF(30, 0), new PointF(41.66666641f, 0), new PointF(58.33333321f, 30), new PointF(70, 30), new PointF(81.66666f, 30), new PointF(95, 4.99999952f), new PointF(100, 0) }); AddLabel(curve1, "CurveNode", Position.Center); diagram1.Model.AppendChild(curve1); CircularArc circular = new CircularArc(new RectangleF(640, 150, 100, 100), 0, 270); circular.FillStyle.Color = Color.FromArgb(240, 242, 240); circular.FillStyle.ForeColor = Color.White; circular.FillStyle.Type = FillStyleType.LinearGradient; circular.LineStyle.LineColor = Color.DarkGray; circular.PinPoint = new PointF(700, 200); AddLabel(circular, "CircularArc", Position.Center); diagram1.Model.AppendChild(circular); Line line1 = new Line(new PointF(700, 320), new PointF(700, 430)); line1.LineStyle.LineColor = Color.DarkGray; AddLabel(line1, "line", Position.TopCenter); diagram1.Model.AppendChild(line1); PolylineNode polyLine = new PolylineNode(new PointF[] { new PointF(640, 500), new PointF(760, 500), new PointF(640, 540), new PointF(760, 540) }); polyLine.LineStyle.LineColor = Color.DarkGray; polyLine.LineStyle.LineWidth = 1; Syncfusion.Windows.Forms.Diagram.Label label = new Syncfusion.Windows.Forms.Diagram.Label(polyLine, "PolyLine Node"); label.OffsetX = polyLine.BoundingRectangle.Width / 5f; label.OffsetY = polyLine.BoundingRectangle.Height + 10; label.FontStyle.Family = "Segoe UI"; label.FontColorStyle.Color = Color.Black; label.FontStyle.Size = 9; polyLine.Labels.Add(label); diagram1.Model.AppendChild(polyLine); BezierCurve bezier = new BezierCurve(new PointF[] { new PointF(100, 470), new PointF(160, 470), new PointF(160, 560), new PointF(220, 560) }); AddLabel(bezier, "BezierCurve", Position.BottomCenter); diagram1.Model.AppendChild(bezier); SplineNode spline = new SplineNode(new PointF[] { new PointF(400, 460), new PointF(520, 500), new PointF(400, 520) }); spline.LineStyle.LineColor = Color.Black; spline.LineStyle.LineWidth = 1; AddLabel(spline, "Spline", Position.BottomCenter); diagram1.Model.AppendChild(spline); }
/// <summary> /// Initialize the Diagram from XML file /// </summary> protected void InitializeDiagramFromXMLData(string path) { diagram1.Model.Clear(); diagram1.Model.BeginUpdate(); RoundRect rrect = new RoundRect(900, 30, 250, 70, MeasureUnits.Pixel); rrect.FillStyle.Color = Color.Transparent; rrect.EditStyle.AllowSelect = false; rrect.LineStyle.LineColor = Color.Gray; Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(rrect, "Relationships"); lbl.Position = Position.TopLeft; lbl.FontStyle.Family = "Segoe UI"; lbl.FontStyle.Size = 9; rrect.Labels.Add(lbl); Syncfusion.Windows.Forms.Diagram.Label lblOneToOne = new Syncfusion.Windows.Forms.Diagram.Label(rrect, ": OneToOne"); lblOneToOne.FontStyle.Family = "Segoe UI"; lblOneToOne.FontStyle.Size = 9; lblOneToOne.OffsetX = 120; lblOneToOne.OffsetY = 10; rrect.Labels.Add(lblOneToOne); Syncfusion.Windows.Forms.Diagram.Label lblOneToMany = new Syncfusion.Windows.Forms.Diagram.Label(rrect, ": OneToMany"); lblOneToMany.FontStyle.Family = "Segoe UI"; lblOneToMany.FontStyle.Size = 9; lblOneToMany.OffsetX = 120; lblOneToMany.OffsetY = 40; rrect.Labels.Add(lblOneToMany); diagram1.Model.AppendChild(rrect); LineConnector oneToOne = new LineConnector(new PointF(910, 50), new PointF(1010, 50)); oneToOne.EditStyle.AllowSelect = false; oneToOne.TailDecorator.DecoratorShape = DecoratorShape.FilledDiamond; oneToOne.HeadDecorator.DecoratorShape = DecoratorShape.FilledDiamond; diagram1.Model.AppendChild(oneToOne); LineConnector oneToMany = new LineConnector(new PointF(910, 80), new PointF(1010, 80)); oneToMany.EditStyle.AllowSelect = false; oneToMany.TailDecorator.DecoratorShape = DecoratorShape.Diamond; oneToMany.HeadDecorator.DecoratorShape = DecoratorShape.FilledDiamond; diagram1.Model.AppendChild(oneToMany); // Read data from the XML data file and populate a Hashtable using the employee ID as the key Hashtable lstEmployees = this.ReadEmployeeDataFromXMLFile(path); // Create a manager-employee nested list with top-level employees forming the root nodes ArrayList sortedlist = this.GetSortedEmployeesList(lstEmployees); foreach (Employee emply in sortedlist) { this.IterUpdateSubEmployeeCount(emply); } // Create diagram symbol nodes for each employee and initialize the diagram this.CreateOrgDiagramFromList(sortedlist); lstEmployees.Clear(); sortedlist.Clear(); //Make connection between nodes ConnectNodes(); diagram1.Model.EndUpdate(); diagram1.View.SelectionList.Clear(); }
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); }
public HeaderRectanglePlan() { Syncfusion.Windows.Forms.Diagram.Rectangle MainRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 200, 150); MainRect.FillStyle.Color = Color.White; MainRect.LineStyle.LineColor = Color.Black; Syncfusion.Windows.Forms.Diagram.Rectangle HeadContent = new Syncfusion.Windows.Forms.Diagram.Rectangle(MainRect.BoundingRectangle.Width / 2 - 50, -10, 100, 20); HeadContent.FillStyle.Color = Color.LightYellow; Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label(); lbl.Text = "Plan"; lbl.SizeToNode = true; lbl.Position = Position.Center; lbl.FontStyle.Size = 12; lbl.FontStyle.Bold = true; HeadContent.Labels.Add(lbl); this.AppendChild(MainRect); this.AppendChild(HeadContent); Syncfusion.Windows.Forms.Diagram.Rectangle rects; rects = new Syncfusion.Windows.Forms.Diagram.Rectangle(15, 30, 10, 10); rects.FillStyle.Color = Color.Yellow; rects.LineStyle.LineColor = Color.Black; this.AppendChild(rects); rects = new Syncfusion.Windows.Forms.Diagram.Rectangle(20, 35, 10, 10); rects.FillStyle.Color = Color.Yellow; rects.LineStyle.LineColor = Color.Black; this.AppendChild(rects); RectangleF rect = new RectangleF(40, 30, 150, 25); TextNode txtContent = new TextNode("-Planning", rect); txtContent.BackgroundStyle.Color = Color.Transparent; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = 10; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; this.AppendChild(txtContent); PointF[] pts = new PointF[] { new PointF(25, 5), new PointF(5, 5), new PointF(15, 15) }; Syncfusion.Windows.Forms.Diagram.Polygon triangle = new Syncfusion.Windows.Forms.Diagram.Polygon(pts); triangle.PinPoint = new PointF(15 + triangle.BoundingRectangle.Width / 2, 65); triangle.FillStyle.Color = Color.White; this.AppendChild(triangle); rect = new RectangleF(40, 52.5f, 150, 25); txtContent = new TextNode("-Activity", rect); txtContent.BackgroundStyle.Color = Color.Transparent; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = 10; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; this.AppendChild(txtContent); pts = new PointF[] { new PointF(15, 15), new PointF(0, 15), new PointF(5, 5), new PointF(10, 5), new PointF(10, 0), new PointF(15, 0) }; Syncfusion.Windows.Forms.Diagram.PolylineNode star = new Syncfusion.Windows.Forms.Diagram.PolylineNode(pts); star.PinPoint = new PointF(15 + triangle.BoundingRectangle.Width / 2, 88); star.LineStyle.LineColor = Color.Black; this.AppendChild(star); rect = new RectangleF(40, 77.5f, 150, 25); txtContent = new TextNode("-StartUp", rect); txtContent.BackgroundStyle.Color = Color.Transparent; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = 10; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; this.AppendChild(txtContent); Syncfusion.Windows.Forms.Diagram.Ellipse ellipse; ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(18, 105, 15, 15); ellipse.FillStyle.Color = Color.Blue; ellipse.LineStyle.LineWidth = 0; this.AppendChild(ellipse); ellipse = new Syncfusion.Windows.Forms.Diagram.Ellipse(20.5f, 107.5f, 10, 10); ellipse.FillStyle.Color = Color.Gray; ellipse.LineStyle.LineWidth = 0; this.AppendChild(ellipse); rect = new RectangleF(40, 100, 150, 25); txtContent = new TextNode("-Cost Savings Sort", rect); txtContent.BackgroundStyle.Color = Color.Transparent; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = 10; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; this.AppendChild(txtContent); pts = new PointF[] { new PointF(0, 5), new PointF(5, 5), new PointF(10, 0), new PointF(15, 5), new PointF(20, 5), new PointF(15, 10), new PointF(20, 15), new PointF(15, 15), new PointF(10, 20), new PointF(5, 15), new PointF(0, 15), new PointF(5, 10), new PointF(0, 5) }; Syncfusion.Windows.Forms.Diagram.Polygon star1 = new Syncfusion.Windows.Forms.Diagram.Polygon(pts); star1.PinPoint = new PointF(17 + star1.BoundingRectangle.Width / 2, 140); star1.FillStyle.Color = Color.Gray; this.AppendChild(star1); rect = new RectangleF(40, 127, 150, 25); txtContent = new TextNode("-Evaluate & Close", rect); txtContent.BackgroundStyle.Color = Color.Transparent; txtContent.LineStyle.LineWidth = 0; txtContent.FontStyle.Size = 10; txtContent.ReadOnly = true; txtContent.HorizontalAlignment = StringAlignment.Near; txtContent.VerticalAlignment = StringAlignment.Center; this.AppendChild(txtContent); this.EditStyle.AllowSelect = false; }