/// <summary> /// Initialize a new instance of the class. /// </summary> /// <param name="fileName"></param> public EmpSymbol(string fileName) { Syncfusion.Windows.Forms.Diagram.Rectangle groupRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 255, 75); groupRect.Name = "Rectangle"; groupRect.FillStyle.Type = FillStyleType.LinearGradient; groupRect.FillStyle.ForeColor = Color.White; groupRect.FillStyle.Color = System.Drawing.Color.FromArgb(240, 242, 240); groupRect.LineStyle.LineColor = Color.Black; groupRect.LineStyle.LineWidth = 1; groupRect.EditStyle.AllowSelect = false; this.AppendChild(groupRect); System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(fileName); System.Drawing.Image Image = bitmap.GetThumbnailImage(60, 50, null, IntPtr.Zero); bitmap = new System.Drawing.Bitmap(Image); BitmapNode bitmapNode = new BitmapNode(bitmap); bitmapNode.PinPoint = new PointF(bitmapNode.PinPoint.X + 10, bitmapNode.PinPoint.Y + 10); bitmapNode.LineStyle.LineColor = Color.Transparent; bitmapNode.EditStyle.AllowSelect = false; this.AppendChild(bitmapNode); txtNode.PinPoint = new PointF(bitmapNode.PinPoint.X + 40, bitmapNode.PinPoint.Y - 30); txtNode.LineStyle.LineColor = Color.Transparent; txtNode.FontStyle.Size = 9; txtNode.FontStyle.Family = "Arial"; txtNode.SizeToText(new SizeF(130, 100)); this.AppendChild(txtNode); BackgroundShapeType = BackgroundShape.ellipse; SymbolShapeType = SymbolShape.RightDownTriangle; }
private void Form1_Load(object sender, EventArgs e) { // Add a textnode to the home page (Model1) this.diagram1.Model = this.model1; DiagramAppearance(); Syncfusion.Windows.Forms.Diagram.TextNode txtnode = new TextNode(" Coevals Diagram "); txtnode.FontStyle.Family = "Arial"; txtnode.FontStyle.Size = 18; txtnode.FontStyle.Bold = true; txtnode.FontColorStyle.Color = Color.MidnightBlue; txtnode.LineStyle.LineColor = Color.Transparent; txtnode.SizeToText(new Size(1000, 1000)); InsertNode(txtnode, new PointF(200, 20)); Syncfusion.Windows.Forms.Diagram.TextNode txtnode1 = new TextNode("Expand and Collapse concept is featured with this DrillDown."); txtnode1.FontStyle.Size = 9; txtnode1.FontStyle.Bold = true; txtnode1.FontColorStyle.Color = Color.MidnightBlue; txtnode1.LineStyle.LineColor = Color.Transparent; txtnode1.FontStyle.Family = "Arial"; txtnode1.FontStyle.Size = 8; txtnode1.VerticalAlignment = StringAlignment.Center; txtnode1.WrapText = true; txtnode1.SizeToText(new Size(100, 100)); txtnode1.PinPoint = new PointF(540, 95); InsertNode(txtnode1, new PointF(540, 95)); // Add a button that gets triggered to present Model2 this.diagram1.Model.AppendChild(new GrandMotherSymbolClass(this.diagram1, this.model1, this.model2)); this.diagram1.Controller.InPlaceEditing = false; this.diagram1.View.SelectionList.Clear(); this.diagram1.EventSink.NodeMouseEnter += new NodeMouseEventHandler(EventSink_NodeMouseEnter); this.diagram1.EventSink.NodeMouseLeave += new NodeMouseEventHandler(EventSink_NodeMouseLeave); }
/// <summary> /// Insert the TextNode /// </summary> /// <param name="strText">TextNode's Text</param> /// <param name="ptPinPoint">Node's Location</param> /// <param name="layer">Layer</param> /// <returns>returns the text node</returns> private TextNode InsertTextNode(string strText, PointF ptPinPoint, Layer layer) { Syncfusion.Windows.Forms.Diagram.TextNode txtnode = new TextNode(strText); txtnode.FontStyle.Size = 15; txtnode.FontStyle.Family = "Arial"; txtnode.FontColorStyle.Color = Color.Black; txtnode.LineStyle.LineColor = Color.Transparent; txtnode.SizeToText(SizeF.Empty); InsertNode(txtnode, ptPinPoint, layer); return(txtnode); }
/// <summary> /// Appends TextNode to the Layer /// </summary> /// <param name="strText">TextNode's Text</param> /// <param name="ptPinPoint">TextNode's Location</param> /// <param name="layer">layer</param> private void InsertTextNode(string strText, PointF ptPinPoint, Layer layer) { Syncfusion.Windows.Forms.Diagram.TextNode txtnode = new TextNode(strText); txtnode.FontStyle.Size = 10; txtnode.FontStyle.Family = "verdana"; txtnode.FontColorStyle.Color = Color.Black; txtnode.LineStyle.LineColor = Color.Transparent; txtnode.SizeToText(SizeF.Empty); txtnode.PinPoint = ptPinPoint; layer.Nodes.Add(txtnode); txtnode.Layers.Add(layer); diagram1.Model.AppendChild(txtnode); diagram1.Model.BringToFront(txtnode); }
private void AddInfotoImage() { TextNode txtnode = new TextNode("Image created using Syncfusion Essential Diagram"); txtnode.LineStyle.LineColor = Color.Transparent; txtnode.Name = "ImageInfo"; txtnode.BackgroundStyle.Color = Color.Azure; txtnode.FontStyle.Family = "Arial"; txtnode.SizeToText(new SizeF(0, 0)); PointF location = new PointF((this.diagram1.Model.DocumentSize.Width / 2), (this.diagram1.Model.DocumentSize.Height - (2 * (txtnode.Size.Height)))); txtnode.PinPoint = location; this.diagram1.Controller.Model.AppendChild(txtnode); }
protected override void OnMouseClick(EventArgs e) { // Presents the Home page ( Model1 ) this.dig.Model = this.mod1; foreach (Node node in this.mod1.Nodes) { if (node is TextNode) { node.EditStyle.AllowSelect = false; } if (node != null) { this.dig.SelectAll(); this.dig.Controller.Delete(); this.mod1.Nodes.Clear(); break; } } this.dig.Model.AppendChild(new GrandMotherSymbolClass(this.dig, this.mod1, this.mod2)); Syncfusion.Windows.Forms.Diagram.TextNode txtnode1 = new TextNode("Coevals Diagram "); txtnode1.FontStyle.Size = 16; txtnode1.FontStyle.Family = "Segoe UI"; txtnode1.FontStyle.Bold = true; txtnode1.FontColorStyle.Color = Color.Black; txtnode1.LineStyle.LineColor = Color.Transparent; txtnode1.SizeToText(new Size(1000, 1000)); txtnode1.PinPoint = new PointF(300, 25); this.dig.Model.AppendChild(txtnode1); this.dig.View.SelectionList.Clear(); this.Nodes.Clear(); }
// 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 { } }
/// <summary> /// Initialize the diagram /// </summary> protected void InitailizeDiagram() { // Add a TextNode to highlight the Diagram Name Syncfusion.Windows.Forms.Diagram.TextNode txtnode = new TextNode("Simple Flow Diagram"); txtnode.FontStyle.Size = 17; txtnode.FontStyle.Bold = true; txtnode.FontStyle.Family = "Arial"; txtnode.FontColorStyle.Color = Color.Black; txtnode.LineStyle.LineColor = Color.Transparent; txtnode.SizeToText(Size.Empty); InsertNode(txtnode, new PointF(290, 15)); if (this.paletteGroupBar1.CurrentSymbolPalette == null) { return; } // Insert the Network Symbols. // Insert start Node start = InsertNodeFromPallete("Start/End", new PointF(295, 37), "Start", new SizeF(120, 45)); //Insert process1 Node process1 = InsertNodeFromPallete("Process", new PointF(325, 102), "Answer Phone", new SizeF(120, 45)); // Insert decision1 Node decision1 = InsertNodeFromPallete("Decision", new PointF(325, 175), "How can we help?", new SizeF(120, 60)); //Insert process2 Node process2 = InsertNodeFromPallete("Process", new PointF(70, 252), "Take name and company", new SizeF(120, 45)); // Insert process3 Node process3 = InsertNodeFromPallete("Process", new PointF(70, 327), "Transfer to sales", new SizeF(120, 45)); //Insert end1 Node end1 = InsertNodeFromPallete("Start/End", new PointF(40, 402), "Finish", new SizeF(120, 45)); //Insert decision2 Node decision2 = InsertNodeFromPallete("Decision", new PointF(325, 255), "What is problem?", new SizeF(120, 60)); //Insert process4 Node process4 = InsertNodeFromPallete("Process", new PointF(325, 330), "Take name and company", new SizeF(120, 45)); //Insert process5 Node process5 = InsertNodeFromPallete("Process", new PointF(325, 390), "Transfer to help", new SizeF(120, 45)); //Insert end2 Node end2 = InsertNodeFromPallete("Start/End", new PointF(295, 465), "Finish", new SizeF(120, 45)); // Add TextNodes to display Layer Names InsertTextNode("Product info, or help placing order", new PointF(130, 180), new SizeF(135, 35)); InsertTextNode("Other", new PointF(480, 200), new SizeF(90, 30)); InsertTextNode("Shipping", new PointF(235, 280), new SizeF(90, 30)); InsertTextNode("Billing", new PointF(480, 280), new SizeF(90, 30)); InsertTextNode("Problems with product?", new PointF(272, 316), new SizeF(90, 30)); // Create Links between the NetworkSymbols. ConnectNodes(start, process1); ConnectNodes(process1, decision1); ConnectNodes(decision1, process2); ConnectNodes(process2, process3); ConnectNodes(process3, end1); ConnectNodes(decision1, decision2); ConnectNodes(decision2, process4); ConnectNodes(process4, process5); ConnectNodes(process5, end2); ConnectNodes(decision1, "right"); ConnectNodes(decision2, "right"); ConnectNodes(decision2, "left"); }
/// <summary> /// Initialize the Diagram /// </summary> protected void InitailizeDiagram() { Layer ethnet = CreateLayer("Ethernet Layer"); Layer controlnet = CreateLayer("ControlNet Layer"); Layer devicenet = CreateLayer("DeviceNet Layer"); // Add TextNodes to display Layer Names InsertTextNode("Ethernet", new PointF(350, 180), ethnet); InsertTextNode("Control Net", new PointF(320, 370), controlnet); InsertTextNode("Device Net", new PointF(500, 550), devicenet); // Add TextNodes to highlight Various SymbolName. // Add a TextNode to highlight the Diagram Name Syncfusion.Windows.Forms.Diagram.TextNode txtnode = new TextNode("WIRELESS NETWORK FLOW DIAGRAM"); txtnode.FontStyle.Size = 17; txtnode.FontStyle.Bold = true; txtnode.FontStyle.Family = "Arial"; txtnode.FontColorStyle.Color = Color.Black; txtnode.LineStyle.LineColor = Color.Transparent; txtnode.SizeToText(Size.Empty); InsertNode(txtnode, new PointF(415, 25), null); if (this.paletteGroupBar1.CurrentSymbolPalette == null) { return; } // TextNode For Servers InsertHighlightTextNode("Servers", new PointF(250, 100), ethnet); // TextNode For WorkStations InsertHighlightTextNode("WorkStations", new PointF(480, 100), ethnet); // TextNode For Modem InsertHighlightTextNode("Modem", new PointF(600, 175), ethnet); // TextNode For Modem1 InsertHighlightTextNode("Modem1", new PointF(730, 120), ethnet); // TextNode For RemoteController InsertHighlightTextNode("RemoteController", new PointF(870, 100), ethnet); // TextNode For RemoteWorkStations InsertHighlightTextNode("Remote WorkStations", new PointF(930, 250), ethnet); // TextNode For Modem2 InsertHighlightTextNode("Modem2", new PointF(650, 270), ethnet); // TextNode For PortableWorkStations InsertHighlightTextNode("Portable WorkStation", new PointF(930, 320), ethnet); // TextNode For Modem3 InsertHighlightTextNode("Modem3", new PointF(500, 350), ethnet); // TextNode For Modem4 InsertHighlightTextNode("Modem4", new PointF(450, 230), ethnet); // TextNode For ControlLogic InsertHighlightTextNode("ControlLogic", new PointF(170, 400), controlnet); // TextNode For ControlLogic1 InsertHighlightTextNode("ControlLogic1", new PointF(750, 360), controlnet); // TextNode For Hub Management Interface InsertHighlightTextNode("HMI", new PointF(910, 410), devicenet); // TextNode For DriveC InsertHighlightTextNode("DriveC", new PointF(800, 520), devicenet); // TextNode For DriveB InsertHighlightTextNode("DriveB", new PointF(650, 520), devicenet); // TextNode For DriveA InsertHighlightTextNode("DriveA", new PointF(550, 520), devicenet); // TextNode For Sensor InsertHighlightTextNode("Sensor", new PointF(400, 510), devicenet); // TextNode For AnalogI/O Device InsertHighlightTextNode("Analog I/O Device", new PointF(250, 550), devicenet); // Insert the Network Symbols. // Insert server Node server = InsertNodeFromPallete(0, new PointF(236, 100), ethnet); //Insert server1 Node server1 = InsertNodeFromPallete(0, new PointF(186, 100), ethnet); // Insert WorkStation Node ws = InsertNodeFromPallete(1, new PointF(420, 100), ethnet); //Insert WorkStation Node ws1 = InsertNodeFromPallete(1, new PointF(520, 100), ethnet); // Insert modem Node modem = InsertNodeFromPallete(2, new PointF(630, 140), ethnet); //Insert modem1 Node modem1 = InsertNodeFromPallete(2, new PointF(760, 140), ethnet); //Insert Portable WS Node rc = InsertNodeFromPallete(3, new PointF(890, 110), ethnet); //Insert RemoteWorkStations Node rws = InsertNodeFromPallete(1, new PointF(850, 230), ethnet); //Insert modem2 Node modem2 = InsertNodeFromPallete(2, new PointF(650, 220), ethnet); //Insert RemoteController Node pws = InsertNodeFromPallete(1, new PointF(850, 320), ethnet); //Insert modem3 Node modem3 = InsertNodeFromPallete(2, new PointF(500, 300), ethnet); //Insert modem4 Node modem4 = InsertNodeFromPallete(2, new PointF(500, 200), ethnet); //Insert ControlLogic Node clx = InsertNodeFromPallete(3, new PointF(800, 360), controlnet); //Insert ControlLogic1 Node clx1 = InsertNodeFromPallete(3, new PointF(252, 360), controlnet); // Insert HMI Node hmi = InsertNodeFromPallete(4, new PointF(880, 410), devicenet); // Insert Analog I/O Device Node analog = InsertNodeFromPallete(5, new PointF(250, 470), devicenet); // InsertSensor Device Node sensor = InsertNodeFromPallete(6, new PointF(450, 470), devicenet); //Insert DriveA Node driveA = InsertNodeFromPallete(7, new PointF(550, 470), devicenet); //Insert DriveB Node driveB = InsertNodeFromPallete(7, new PointF(650, 470), devicenet); //Insert DriveC Node driveC = InsertNodeFromPallete(7, new PointF(800, 470), devicenet); //Insert Arrows to indicate the Network Flow. InsertNodeFromPallete(8, new PointF(400, 170), 0, ethnet); InsertNodeFromPallete(8, new PointF(250, 170), 90, ethnet); InsertNodeFromPallete(8, new PointF(565, 340), 0, controlnet); InsertNodeFromPallete(8, new PointF(270, 420), 90, devicenet); InsertNodeFromPallete(8, new PointF(575, 420), 90, devicenet); InsertNodeFromPallete(8, new PointF(250, 280), 90, ethnet); // Create Links between the NetworkSymbols. ConnectNodes(server, server1); ConnectNodes(server1, ws); ConnectNodes(modem4, server1); ConnectNodes(server, clx1); ConnectNodes(ws, ws1); ConnectNodes(ws1, modem); ConnectNodes(ws1, modem4); ConnectNodes(modem1, modem); ConnectNodes(modem1, rc); ConnectNodes(modem2, rws); ConnectNodes(modem3, pws); ConnectNodes(modem3, modem4); ConnectNodes(modem2, modem4); ConnectNodes(clx, clx1); ConnectNodes(clx, driveB); ConnectNodes(clx1, analog); ConnectNodes(clx, driveA); ConnectNodes(clx1, sensor); ConnectNodes(hmi, driveC); ConnectNodes(hmi, driveB); }
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() == "Boys") { this.dig.Controller.SelectAll(); this.dig.Controller.Delete(); this.mod1.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.dig.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.dig.Model.AppendChild(txtnode2); this.dig.Model.AppendChild(new HomeNode(this.dig, this.mod1, this.mod2)); BoySymbolClass symbol1 = new BoySymbolClass(); symbol1.PinPoint = new PointF(280, 120); this.dig.Model.AppendChild(symbol1); BoySymbolClass symbol2 = new BoySymbolClass(); symbol2.PinPoint = new PointF(380, 180); this.dig.Model.AppendChild(symbol2); BoySymbolClass symbol3 = new BoySymbolClass(); symbol3.PinPoint = new PointF(380, 280); this.dig.Model.AppendChild(symbol3); BoySymbolClass symbol4 = new BoySymbolClass(); symbol4.PinPoint = new PointF(280, 320); this.dig.Model.AppendChild(symbol4); BoySymbolClass symbol5 = new BoySymbolClass(); symbol5.PinPoint = new PointF(180, 280); this.dig.Model.AppendChild(symbol5); BoySymbolClass symbol6 = new BoySymbolClass(); symbol6.PinPoint = new PointF(180, 180); this.dig.Model.AppendChild(symbol6); // Grand Mother GrandMotherSymbolClass gm = new GrandMotherSymbolClass(this.dig, this.mod1, this.mod2, true); gm.PinPoint = new PointF(65, 30); gm.Size = new SizeF(20, 20); gm.LineStyle.LineColor = Color.Transparent; this.dig.Model.AppendChild(gm); ConnectNodes(symbol1, symbol2); ConnectNodes(symbol2, symbol3); ConnectNodes(symbol4, symbol3); ConnectNodes(symbol4, symbol5); ConnectNodes(symbol5, symbol6); ConnectNodes(symbol1, symbol6); this.dig.View.SelectionList.Clear(); this.Nodes.Clear(); } }