Exemplo n.º 1
0
        private void CreateShapeWithAutoPrevPort()
        {
            NBasicShapesFactory factory = new NBasicShapesFactory(document);
            NShape shape = factory.CreateShape((int)BasicShapes.Triangle);

            shape.Name              = "Point Port with AutoPrev direction";
            shape.Bounds            = base.GetGridCell(4, 1);
            shape.Style.FillStyle   = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant4, Color.FromArgb(192, 194, 194), Color.FromArgb(129, 133, 133));
            shape.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108));

            NPointPort port = new NPointPort(shape.UniqueId, PointIndexMode.Second, -1);

            port.DirectionMode = PointPortDirectionMode.AutoPrev;
            shape.Ports.RemoveAllChildren();
            shape.Ports.AddChild(port);

            document.ActiveLayer.AddChild(shape);

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

            document.ActiveLayer.AddChild(text);
        }
Exemplo n.º 2
0
        private void customPointIndexNumeric_ValueChanged(object sender, System.EventArgs e)
        {
            if (EventsHandlingPaused)
            {
                return;
            }

            if (EventsHandlingPaused)
            {
                return;
            }

            // get the selected shape
            NShape shape = view.Selection.AnchorNode as NShape;

            if (shape == null || shape.Ports == null)
            {
                return;
            }

            // get a point port
            NPointPort port = (shape.Ports.DefaultInwardPort as NPointPort);

            if (port == null)
            {
                return;
            }

            PauseEventsHandling();

            // change the custom point index of a point port
            port.CustomPointIndex = (int)customPointIndexNumeric.Value;

            ResumeEventsHandling();
            document.SmartRefreshAllViews();
        }
Exemplo n.º 3
0
        private void CreateShapeWithPointPort()
        {
            // create a shape with one point port
            NBasicShapesFactory factory = new NBasicShapesFactory(document);
            NShape shape = factory.CreateShape((int)BasicShapes.Pentagram);

            shape.Name   = "Shape with a Point Port";
            shape.Bounds = base.GetGridCell(4, 1);

            NPointPort port = new NPointPort(shape.UniqueId, PointIndexMode.Second, -1);

            shape.Ports.RemoveAllChildren();
            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 Point Port", base.GetGridCell(4, 2, 0, 1));

            document.ActiveLayer.AddChild(text);
        }
Exemplo n.º 4
0
        private void portIndexModeComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (portIndexModeComboBox.SelectedItem == null)
            {
                return;
            }

            if (EventsHandlingPaused)
            {
                return;
            }

            // get the selected shape
            NShape shape = view.Selection.AnchorNode as NShape;

            if (shape == null || shape.Ports == null)
            {
                return;
            }

            // get a point port
            NPointPort port = (shape.Ports.DefaultInwardPort as NPointPort);

            if (port == null)
            {
                return;
            }

            PauseEventsHandling();

            // change the point index mode of a point port
            port.PointIndexMode = (PointIndexMode)portIndexModeComboBox.SelectedItem;

            ResumeEventsHandling();
            document.SmartRefreshAllViews();
        }