예제 #1
0
    /// <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;
    }
예제 #2
0
        /// <summary>
        /// Create diagram symbol nodes for each employee in the organization and add these symbols to the diagram
        /// Create links between manager and sub-employees to depict the org structure
        /// </summary>
        /// <param name="alemployees"> Employees list</param>
        protected void CreateOrgDiagramFromList(ArrayList alemployees)
        {
            // Temporarily suspend the Diagram Model redrawing
            this.diagram1.Model.BeginUpdate();

            foreach (Employee emply in alemployees)
            {
#if !NETCORE
                String fileName = @"..\..\..\..\..\..\..\Common\Images\Diagram\OrgChart Layout\" + emply.ImageName + ".png";
#else
                String fileName = @"..\..\..\..\..\..\..\..\Common\Images\Diagram\OrgChart Layout\" + emply.ImageName + ".png";
#endif
                BitmapNode employeeSymbol = new BitmapNode(new Bitmap(fileName), new RectangleF(100, 100, 75, 75));
                employeeSymbol.LineStyle.LineColor = Color.Transparent;
                employeeSymbol.PropertyBag.Add("Name", emply.EmployeeName);
                employeeSymbol.PropertyBag.Add("ID", emply.EmployeeID);
                employeeSymbol.PropertyBag.Add("Designation", emply.Designation);
                this.diagram1.Model.AppendChild(employeeSymbol);
                this.IterCreateEmployeeSymbol(emply, employeeSymbol);
            }

            // Enable the Model redraw
            this.diagram1.Model.EndUpdate();

            // Instruct the LayoutManager to calculate and layout the diagram nodes
            LayoutNodes();
        }
예제 #3
0
 public GrandMotherSymbolClass()
 {
     bmpnode      = new BitmapNode(new Bitmap(@"..\..\..\..\..\..\..\Common\Images\Diagram\Drill Down images\image2_48.png"));
     bmpnode.Name = "Grand Mother";
     bmpnode.LineStyle.LineWidth = 0;
     this.AppendChild(bmpnode);
 }
예제 #4
0
        public BoySymbolClass()
        {
            bmpnode      = new BitmapNode(new Bitmap(@"..\..\..\..\..\..\..\Common\Images\Diagram\Drill Down images\image6_48.png"));
            bmpnode.Name = "Boy";
            bmpnode.LineStyle.LineWidth = 0;
            bmpnode.PinPoint            = new Point(305, 130);

            this.AppendChild(bmpnode);
        }
예제 #5
0
        /// <summary>
        /// this is used in GraphInstances
        /// To resize proportionate to new size
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        public virtual void ResizeWith(int width, int height)
        {
            this.width  = width;
            this.height = height;

            int c = Nodes.Count;

            for (int i = 0; i < c; i++)
            {
                Node n = Nodes[i];

                if (OutputNodes.Contains(n.Id))
                {
                    continue;
                }
                if (InputNodes.Contains(n.Id))
                {
                    continue;
                }

                if (n is BitmapNode)
                {
                    BitmapNode bn = (BitmapNode)n;
                    bn.TryAndProcess();
                }
                else
                {
                    Point osize;

                    if (OriginSizes.TryGetValue(n.Id, out osize))
                    {
                        float wratio = width / (float)osize.X;
                        float hratio = height / (float)osize.Y;

                        int fwidth  = (int)Math.Min(4096, Math.Max(16, Math.Round(osize.X * wratio)));
                        int fheight = (int)Math.Min(4096, Math.Max(16, Math.Round(osize.Y * hratio)));

                        n.Width  = fwidth;
                        n.Height = fheight;
                    }
                }
            }

            c = InputNodes.Count;

            for (int i = 0; i < c; i++)
            {
                Node n;
                if (NodeLookup.TryGetValue(InputNodes[i], out n))
                {
                    InputNode inp = (InputNode)n;
                    inp.TryAndProcess();
                }
            }
        }
예제 #6
0
        public GirlSymbolClass(String name, Syncfusion.Windows.Forms.Diagram.Controls.Diagram diagram, Syncfusion.Windows.Forms.Diagram.Model model1, Syncfusion.Windows.Forms.Diagram.Model model2)
        {
            bmpnode                     = new BitmapNode(new Bitmap(@"..\..\..\..\..\..\..\Common\Images\Diagram\Drill Down images\image5_48.png"));
            bmpnode.Name                = name;
            bmpnode.PinPoint            = new Point(305, 130);
            bmpnode.LineStyle.LineWidth = 0;
            this.AppendChild(bmpnode);
            this.diagram1 = diagram;

            this.model1 = model1;
            this.model2 = model2;
        }
예제 #7
0
        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;
            }
        }
예제 #8
0
        public GirlSymbolClass()
        {
#if !NETCORE
            bmpnode = new BitmapNode(new Bitmap(@"..\..\..\..\..\..\..\Common\Images\Diagram\Drill Down images\image5_48.png"));
#else
            bmpnode = new BitmapNode(new Bitmap(@"..\..\..\..\..\..\..\..\Common\Images\Diagram\Drill Down images\image5_48.png"));
#endif
            bmpnode.Name = "Girl";
            bmpnode.LineStyle.LineWidth = 0;
            bmpnode.PinPoint            = new Point(305, 130);

            this.AppendChild(bmpnode);
        }
예제 #9
0
        public HomeNode(Syncfusion.Windows.Forms.Diagram.Controls.Diagram diagram, Syncfusion.Windows.Forms.Diagram.Model model1, Syncfusion.Windows.Forms.Diagram.Model model2)
        {
            bmpnode                     = new BitmapNode(new Bitmap(@"..\..\..\..\..\..\..\Common\Images\Diagram\Drill Down images\house_48_hot(1).png"));
            bmpnode.Name                = "Grand Mother";
            bmpnode.PinPoint            = new Point(30, 30);
            bmpnode.Size                = new SizeF(20, 20);
            bmpnode.LineStyle.LineWidth = 0;
            this.AppendChild(bmpnode);

            mod1 = model1;
            mod2 = model2;
            dig  = diagram;
        }
예제 #10
0
        public GrandMotherSymbolClass(Syncfusion.Windows.Forms.Diagram.Controls.Diagram diagram, Syncfusion.Windows.Forms.Diagram.Model model1, Syncfusion.Windows.Forms.Diagram.Model model2, bool Previous)
        {
            bmpnode      = new BitmapNode(new Bitmap(@"..\..\..\..\..\..\..\Common\Images\Diagram\Drill Down images\prev.png"));
            bmpnode.Name = "Back";
            bmpnode.LineStyle.LineWidth = 0;
            bmpnode.PinPoint            = new Point(300, 180);
            this.AppendChild(bmpnode);

            this.dig = diagram;

            this.mod1 = model1;
            this.mod2 = model2;
        }
예제 #11
0
        public GrandMotherSymbolClass(Syncfusion.Windows.Forms.Diagram.Controls.Diagram diagram, Syncfusion.Windows.Forms.Diagram.Model model1, Syncfusion.Windows.Forms.Diagram.Model model2)
        {
#if !NETCORE
            bmpnode = new BitmapNode(new Bitmap(@"..\..\..\..\..\..\common\Images\Diagram\Drill Down images\image2_48.png"));
#else
            bmpnode = new BitmapNode(new Bitmap(@"..\..\..\..\..\..\..\common\Images\Diagram\Drill Down images\image2_48.png"));
#endif
            bmpnode.Name                = "Grand Mother";
            bmpnode.PinPoint            = new Point(300, 180);
            bmpnode.LineStyle.LineWidth = 0;
            this.AppendChild(bmpnode);

            this.dig = diagram;

            this.mod1 = model1;
            this.mod2 = model2;
        }
예제 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WeatherNode"/> class.
        /// </summary>
        public WeatherNode()
            : base()
        {
            m_imageNode      = new BitmapNode(new Bitmap(Image.FromFile(@"..\..\..\..\..\..\..\Common\Images\Diagram\Weather Monitoring\Sunny.png")));
            m_imageNode.Size = new SizeF(32, 32);
            m_imageNode.LineStyle.LineWidth = 0;
            this.EditStyle.AllowSelect      = false;
            this.AppendChild(m_imageNode);
            Label lbl = new Label();

            lbl.FontStyle.Family     = "Arial";
            lbl.Position             = Position.TopCenter;
            lbl.FontColorStyle.Color = Color.White;
            this.Labels.Add(lbl);
            lbl = new Label();
            lbl.FontStyle.Family     = "Arial";
            lbl.Position             = Position.MiddleRight;
            lbl.FontColorStyle.Color = Color.White;
            this.Labels.Add(lbl);
        }
예제 #13
0
        /// <summary>
        ///  Iterative sub-employee symbol node creation
        /// </summary>
        /// <param name="emply">Employess business object</param>
        /// <param name="emplysymbol">Employee Node</param>
        protected void IterCreateEmployeeSymbol(Employee emply, BitmapNode bmpNode)
        {
            foreach (Employee subemply in emply.SubEmployees)
            {
                String fileName = @"..\..\..\..\..\..\..\Common\Images\Diagram\OrgChart Layout\" + subemply.ImageName + ".png";
                // Create a BitmapNode for each of the sub-employees of the particular employee
                BitmapNode subemplysymbol = new BitmapNode(new Bitmap(fileName), new RectangleF(100, 100, 75, 75));
                subemplysymbol.LineStyle.LineColor = Color.Transparent;
                subemplysymbol.PropertyBag.Add("Name", subemply.EmployeeName);
                subemplysymbol.PropertyBag.Add("ID", subemply.EmployeeID);
                subemplysymbol.PropertyBag.Add("Designation", subemply.Designation);
                this.diagram1.Model.AppendChild(subemplysymbol);

                bmpNode.EnableCentralPort        = true;
                subemplysymbol.EnableCentralPort = true;
                ConnectNodes(bmpNode, subemplysymbol);

                this.IterCreateEmployeeSymbol(subemply, subemplysymbol);
            }
        }
예제 #14
0
        /// <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);
        }