示例#1
0
        private void CreateCompositePointShape()
        {
            NRectangleF modelBounds = new NRectangleF(-1, -1, 2, 2);
            float       centerX     = 0;

            // create composite geometry model
            NCompositeGeometry composite = new NCompositeGeometry();

            composite.Name = "Composite Point";

            // add ellipse
            composite.AddChild(new NEllipsePath(new NRectangleF(modelBounds.X, modelBounds.Y, modelBounds.Width / 2, modelBounds.Height)));

            // add cross
            GraphicsPath path = new GraphicsPath();

            path.AddLine(centerX, modelBounds.Y, modelBounds.Right, modelBounds.Bottom);
            path.StartFigure();
            path.AddLine(modelBounds.Right, modelBounds.Y, centerX, modelBounds.Bottom);
            composite.AddChild(new NCustomPath(path, PathType.OpenFigure));

            // update the model bounds of the composite
            composite.UpdateModelBounds();

            // add it to the point shape stencil
            document.PointShapeStencil.AddChild(composite);
        }
        private void CreateCompositeArrowheadShape()
        {
            NRectangleF modelBounds = new NRectangleF(0, -1, 2, 2);

            // create composite geometry and name it
            NCompositeGeometry geometry = new NCompositeGeometry();

            geometry.Name = "Composite Arrowhead";

            // add rect
            geometry.AddChild(new NRectanglePath(new NRectangleF(modelBounds.X,
                                                                 modelBounds.Y,
                                                                 modelBounds.Width / 2,
                                                                 modelBounds.Height)));

            // add slash 1
            float x = modelBounds.X + (modelBounds.Width * 3) / 4;

            geometry.AddChild(new NLinePath(new NPointF(x, modelBounds.Y),
                                            new NPointF(x, modelBounds.Bottom)));

            // add slash 2
            geometry.AddChild(new NLinePath(new NPointF(modelBounds.Right, modelBounds.Y),
                                            new NPointF(modelBounds.Right, modelBounds.Bottom)));

            geometry.UpdateModelBounds();

            // add it to the arrowhead shape stencil
            document.ArrowheadShapeStencil.AddChild(geometry);
        }