Ejemplo n.º 1
0
        private void CreateMoveMeShape()
        {
            // create the center shape to which all other shapes connect
            NRectangleF cell = base.GetGridCell(3, 0);

            cell.Inflate(-5, -5);

            NRectangleShape shape = new NRectangleShape(cell);

            shape.Name = "Move Me";
            shape.Text = "Move Me Close to Another Shape";

            shape.Style.FillStyle   = new NColorFillStyle(Color.FromArgb(247, 150, 56));
            shape.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108));

            // create an outward port
            shape.CreateShapeElements(ShapeElementsMask.Ports);
            NRotatedBoundsPort port = new NRotatedBoundsPort(shape.UniqueId, ContentAlignment.TopCenter);

            port.Type = PortType.Outward;
            shape.Ports.AddChild(port);
            shape.Ports.DefaultOutwardPortUniqueId = port.UniqueId;

            // add it to the active layer and store for reuse
            document.ActiveLayer.AddChild(shape);
            centerShape = shape;
        }
Ejemplo n.º 2
0
        private NShape CreateShape(string name)
        {
            NShape shape = new NRectangleShape(0, 0, 100, 100);

            shape.Name = name;
            shape.Text = name + " Node";

            // Create a center port
            shape.CreateShapeElements(ShapeElementsMask.Ports);
            NDynamicPort port = new NDynamicPort(new NContentAlignment(0, 0), DynamicPortGlueMode.GlueToContour);

            shape.Ports.AddChild(port);

            return(shape);
        }
Ejemplo n.º 3
0
        private void CreateShapeWithAutoCenterDirection()
        {
            NRectangleShape shape = new NRectangleShape(base.GetGridCell(1, 1));

            shape.Name              = "Port with Auto Center direction";
            shape.Style.FillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(192, 194, 194), Color.FromArgb(129, 133, 133));
            shape.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108));

            shape.CreateShapeElements(ShapeElementsMask.Ports);
            NRotatedBoundsPort port = new NRotatedBoundsPort(new NContentAlignment(50, 30));

            port.DirectionMode = BoundsPortDirectionMode.AutoCenter;
            shape.Ports.AddChild(port);

            document.ActiveLayer.AddChild(shape);

            // describe it
            NTextShape text = new NTextShape("Port with Auto Center direction", base.GetGridCell(1, 2, 0, 1));

            document.ActiveLayer.AddChild(text);
        }
Ejemplo n.º 4
0
        private void CreateShapeWithRotatedBoundsPort()
        {
            // create a shape with one rotated bounds port
            NRectangleShape shape = new NRectangleShape(base.GetGridCell(2, 1));

            shape.Name = "Shape with Rotated Bounds Port";

            shape.CreateShapeElements(ShapeElementsMask.Ports);

            NRotatedBoundsPort port = new NRotatedBoundsPort(shape.UniqueId, ContentAlignment.TopLeft);

            shape.Ports.AddChild(port);
            shape.Ports.DefaultInwardPortUniqueId = port.UniqueId;

            // connect it with the center shape
            document.ActiveLayer.AddChild(shape);
            ConnectShapes(centerShape, shape);

            // describe it
            NTextShape text = new NTextShape("Shape with Rotated Bounds Port", base.GetGridCell(2, 2, 0, 1));

            document.ActiveLayer.AddChild(text);
        }