private NShape createPort(string name, PortType type)
        {
            int width  = 10;
            int height = 10;

            NShape port;

            port = new NPolygonShape(new NPointF[] { new NPointF(0, 0),
                                                     new NPointF((int)(width * 1.5), 0),
                                                     new NPointF((int)(width * 1.5 + 10), (int)(height / 2)),
                                                     new NPointF((int)(width * 1.5), (int)(height)),
                                                     new NPointF(0, (int)(height)) });

            port.Name = name;

            port.CreateShapeElements(ShapeElementsMask.Ports);

            NDynamicPort portInner;

            if (type == PortType.IN)
            {
                portInner = new NDynamicPort(new NContentAlignment(-50, 0), DynamicPortGlueMode.GlueToContour);
            }
            else
            {
                portInner = new NDynamicPort(new NContentAlignment(50, 0), DynamicPortGlueMode.GlueToContour);
            }
            portInner.Name = name;
            port.Ports.AddChild(portInner);


            return(port);
        }
        private UDNGroup CreateGlobalPort(string name, PortType type)
        {
            int width  = 10;
            int height = 15;

            UDNGroup group = new UDNGroup();

            group.Name = name;

            NShape port = new NPolygonShape(new NPointF[] { new NPointF(0, 0),
                                                            new NPointF((int)(width * 1.5), 0),
                                                            new NPointF((int)(width * 1.5 + 10), (int)(height / 2)),
                                                            new NPointF((int)(width * 1.5), (int)(height)),
                                                            new NPointF(0, (int)(height)) });

            group.Shapes.AddChild(port);

            port.Name = name;

            port.CreateShapeElements(ShapeElementsMask.Ports);

            NDynamicPort portInner;

            if (type == PortType.IN)
            {
                portInner = new NDynamicPort(new NContentAlignment(50, 0), DynamicPortGlueMode.GlueToContour);
            }
            else
            {
                portInner = new NDynamicPort(new NContentAlignment(-50, 0), DynamicPortGlueMode.GlueToContour);
            }
            portInner.Name = name;
            port.Ports.AddChild(portInner);

            NTextShape nodeName;

            if (type == PortType.IN)
            {
                nodeName = new NTextShape(name, -(name.Length * 8), 0, name.Length * 8, height);
            }
            else
            {
                nodeName = new NTextShape(name, port.Bounds.Width, 0, name.Length * 8, height);
            }
            nodeName.Style.TextStyle           = new NTextStyle();
            nodeName.Style.TextStyle.FontStyle = new NFontStyle(new Font("Arial", 9));
            if (type == PortType.IN)
            {
                nodeName.Style.TextStyle.StringFormatStyle.HorzAlign = Nevron.HorzAlign.Right;
            }
            else
            {
                nodeName.Style.TextStyle.StringFormatStyle.HorzAlign = Nevron.HorzAlign.Left;
            }

            group.Shapes.AddChild(nodeName);

            group.UpdateModelBounds();

            return(group);
        }