can't add a Nstep2Connector


https://www.nevron.com/Forum/Topic8842.aspx
Print Topic | Close Window

By Hans Henrik Friis Pedersen - 10 Years Ago
Hi,

Why can't I add NStep2 Comector between a table and NCompositeShape?

The NCompositeShape does have port - it just seems that they can't be connected?


 NTableShape table = new NTableShape(10, 10, 100, 100);
            //NTableShape table = (NTableShape)shape;
            table.InitTable(2, 2);
            table[0, 0].Text = "Cell 1";
            table[1, 0].Text = "Cell 2";
            table[0, 1].Text = "Cell 3";
            table[1, 1].Text = "Cell 4";
            //shape.
            document1.ActiveLayer.AddChild(table);
           
            NCompositeShape shape = new NCompositeShape();

            NRectangleShape rectx = new NRectangleShape(new NRectangleF(150, 150, 50, 50));

            NShape rect2 = factory.CreateShape(BasicShapes.Rectangle);
            rect2.Bounds = new NRectangleF(350, 200, 75, 75);
            rect2.CreateShapeElements(ShapeElementsMask.Ports);
            rect2.Style.FillStyle = new NColorFillStyle(Color.Empty);

            GraphicsPath graphicsPath = new GraphicsPath();
            graphicsPath.StartFigure();
   PointF[] points = new PointF[]
   {
    new PointF(175,140),
    new PointF(175,160),
    new PointF(150,170),
    new PointF(200,170),
                new PointF(175,180),
                new PointF(175,200),
   };

   graphicsPath.AddLines(points);

            NPointF[] points2 = new NPointF[]
   {
    new NPointF(145,140),
    new NPointF(205,140),
    new NPointF(205,200),
    new NPointF(145,200),
   };

            NPolygonPath cup = new NPolygonPath(points2);
            //cup.Style.FillStyle = new NColorFillStyle(Color.Empty);
           
            //document1.ActiveLayer.AddChild(rect2);
            shape.Primitives.AddChild(new NCustomPath(graphicsPath, PathType.OpenFigure));
            shape.Primitives.AddChild(cup);
            shape.Style.FillStyle = new NColorFillStyle(Color.Empty);
            shape.UpdateModelBounds();


            document1.ActiveLayer.AddChild(shape);

            NStep2Connector hv2 = new NStep2Connector(false);
            hv2.StyleSheetName = NDR.NameConnectorsStyleSheet;
            hv2.Text = "HV1";
            document1.ActiveLayer.AddChild(hv2);

            hv2.FromShape = table;
            hv2.ToShape = shape;