示例#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;
        }
示例#2
0
        private void CreateCenterShape()
        {
            // create the center shape to which all other shapes connect
            NRectangleF cell = base.GetGridCell(3, 0);

            cell.Inflate(-5, -5);

            NEllipseShape shape = new NEllipseShape(cell);

            shape.Name = "Center shape";

            shape.Style.FillStyle   = new NColorFillStyle(Color.FromArgb(50, 0, 0xbb, 0));
            shape.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(0, 0xbb, 0));

            shape.CreateShapeElements(ShapeElementsMask.Ports);

            NDynamicPort port = new NDynamicPort(shape.UniqueId, ContentAlignment.MiddleCenter, DynamicPortGlueMode.GlueToContour);

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

            // add it to the active layer and store for reuse
            document.ActiveLayer.AddChild(shape);
            centerShape = shape;
        }
        private void InitDocument()
        {
            // modify the connectors style sheet
            NStyleSheet styleSheet = (document.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet);

            styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.StartArrowheadStyle.Shape     = ArrowheadShape.None;
            styleSheet.Style.EndArrowheadStyle.StrokeStyle = new NStrokeStyle(1, Color.Black);

            // create a stylesheet for the CPA shapes
            styleSheet = new NStyleSheet("CPA");
            styleSheet.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(68, 90, 108), Color.FromArgb(162, 173, 182));
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the CLIENT shapes
            styleSheet = new NStyleSheet("CLIENT");
            styleSheet.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(247, 150, 56), Color.FromArgb(251, 203, 156));
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the stripes
            styleSheet = new NStyleSheet("STRIPE");
            styleSheet.Style.FillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.FromArgb(221, 221, 221));
            styleSheet.Style.StrokeStyle = new NStrokeStyle(0, Color.White);
            document.StyleSheets.AddChild(styleSheet);

            // create a stylesheet for the ABC texts
            styleSheet = new NStyleSheet("ABC");
            styleSheet.Style.TextStyle = new NTextStyle(new Font("Ariel", 12), Color.FromArgb(150, 150, 150));
            document.StyleSheets.AddChild(styleSheet);

            float abcWidth = 150;

            // configure the document
            base.DefaultGridCellSize = new NSizeF(100, 70);
            base.DefaultGridSpacing  = new NSizeF(30, 30);
            base.DefaultGridOrigin   = new NPointF(60, 30);

            document.Bounds        = new NRectangleF(0, 0, 1000, (6 * base.DefaultGridCellSize.Height) + (7 * base.DefaultGridSpacing.Height));
            document.ShadowsZOrder = ShadowsZOrder.BehindLayer;

            // create the stripes
            NRectanglePath rect = new NRectanglePath(0, 0, document.Width, document.Height / 3);

            rect.StyleSheetName = "STRIPE";
            document.ActiveLayer.AddChild(rect);

            rect = new NRectanglePath(0, document.Height / 3, document.Width, document.Height / 3);
            rect.StyleSheetName = "STRIPE";
            document.ActiveLayer.AddChild(rect);

            rect = new NRectanglePath(0, 2 * document.Height / 3, document.Width, document.Height / 3);
            rect.StyleSheetName = "STRIPE";
            document.ActiveLayer.AddChild(rect);

            // create A,B,C texts
            NTextPrimitive text = new NTextPrimitive("A", document.Width - abcWidth, 0, abcWidth, document.Height / 3);

            text.Mode           = BoxTextMode.Stretch;
            rect.StyleSheetName = "ABC";
            document.ActiveLayer.AddChild(text);

            text                = new NTextPrimitive("B", document.Width - abcWidth, document.Height / 3, abcWidth, document.Height / 3);
            text.Mode           = BoxTextMode.Stretch;
            rect.StyleSheetName = "ABC";
            document.ActiveLayer.AddChild(text);

            text                = new NTextPrimitive("C", document.Width - abcWidth, 2 * document.Height / 3, abcWidth, document.Height / 3);
            text.Mode           = BoxTextMode.Stretch;
            rect.StyleSheetName = "ABC";
            document.ActiveLayer.AddChild(text);

            // add stripe texts
            text = new NTextPrimitive("Sing up client", document.Width - abcWidth, document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            text = new NTextPrimitive("Monthly Accounting Services", document.Width - abcWidth, 2 * document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            text = new NTextPrimitive("Additional Services", document.Width - abcWidth, 3 * document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            // create a layer for the foreground shapes
            NLayer layer = new NLayer();

            document.Layers.AddChild(layer);
            document.ActiveLayerUniqueId = layer.UniqueId;

            // all shapes in the foreground layer have a shadow
            layer.Style.ShadowStyle = new NShadowStyle(
                ShadowType.GaussianBlur,
                Color.Gray,
                new NPointL(5, 5),
                1,
                new NLength(10));

            // shapes in row 1
            NShape newClient                  = base.CreateFlowChartingShape(FlowChartingShapes.Decision, base.GetGridCell(0, 0), "New Client", "CPA");
            NShape register                   = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(0, 1), "Register", "CPA");
            NShape clientAccountInfo          = base.CreateFlowChartingShape(FlowChartingShapes.Data, base.GetGridCell(0, 2), "Client account info", "CPA");
            NShape explainDataEntryProcedures = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(0, 3), "Explain data entry procedures", "CPA");

            // shapes in row 2
            NShape dataEntry         = base.CreateFlowChartingShape(FlowChartingShapes.ManualInput, base.GetGridCell(2, 0), "Data Entry", "CLIENT");
            NShape emailCompleted    = base.CreateFlowChartingShape(FlowChartingShapes.Document, base.GetGridCell(2, 1), "E-mail Completed", "CLIENT");
            NShape review            = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(2, 2), "Review", "CPA");
            NShape needsRevising     = base.CreateFlowChartingShape(FlowChartingShapes.Decision, base.GetGridCell(2, 3), "Needs revising", "CPA");
            NShape emailRevisions    = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(2, 4), "E-mail revisions", "CPA");
            NShape evaluateRevisions = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(2, 5), "Evaluate revisions", "CLIENT");

            // shapes in row 3
            NShape emailApprovedRevisions = base.CreateFlowChartingShape(FlowChartingShapes.Document, base.GetGridCell(3, 2), "E-mail Approved Revisions", "CLIENT");
            NShape evaluateRevisions2     = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(3, 4), "Evaluate Revisions", "CLIENT");
            NShape answerClientEmail      = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(3, 5), "Answer Client E-mail", "CPA");

            // shapes in row 4
            NShape paywoll    = base.CreateFlowChartingShape(FlowChartingShapes.Document, base.GetGridCell(5, 2), "Payroll", "CLIENT");
            NShape taxes      = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(5, 3), "Taxes", "CLIENT");
            NShape controller = base.CreateFlowChartingShape(FlowChartingShapes.Process, base.GetGridCell(5, 4), "Controller", "CPA");

            // some shapes need to have extra ports
            NRotatedBoundsPort port = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(-25, 50));

            port.Name = "BottomLeft";
            evaluateRevisions.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(+25, 50));
            port.Name = "BottomRight";
            evaluateRevisions.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(-25, -50));
            port.Name = "TopLeft";
            answerClientEmail.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(+25, -50));
            port.Name = "TopRight";
            answerClientEmail.Ports.AddChild(port);

            // connect shapes in levels
            base.CreateConnector(newClient, "Center", register, "Center", ConnectorType.Line, "YES");
            base.CreateConnector(register, "Center", clientAccountInfo, "Center", ConnectorType.Line, "");
            base.CreateConnector(clientAccountInfo, "Center", explainDataEntryProcedures, "Center", ConnectorType.Line, "");

            base.CreateConnector(dataEntry, "Center", emailCompleted, "Center", ConnectorType.Line, "");
            base.CreateConnector(emailCompleted, "Center", review, "Center", ConnectorType.Line, "");
            base.CreateConnector(review, "Center", needsRevising, "Center", ConnectorType.Line, "");
            base.CreateConnector(needsRevising, "Center", emailRevisions, "Center", ConnectorType.Line, "YES");
            base.CreateConnector(emailRevisions, "Center", evaluateRevisions, "Center", ConnectorType.Line, "");

            base.CreateConnector(evaluateRevisions2, "Center", emailApprovedRevisions, "Center", ConnectorType.Line, "");

            // connect accross levels
            NStep3Connector connector = (base.CreateConnector(newClient, "Center", dataEntry, "Center", ConnectorType.SideToSide, "NO") as NStep3Connector);

            connector.UseMiddleControlPointPercent = false;
            connector.MiddleControlPointOffset     = -55;

            base.CreateConnector(explainDataEntryProcedures, "Center", dataEntry, "Center", ConnectorType.TopToBottom, "");

            base.CreateConnector(emailApprovedRevisions, "Center", review, "Center", ConnectorType.Line, "");
            base.CreateConnector(emailRevisions, "Center", evaluateRevisions2, "Center", ConnectorType.Line, "");
            base.CreateConnector(evaluateRevisions, "BottomLeft", answerClientEmail, "TopLeft", ConnectorType.Line, "");
            base.CreateConnector(answerClientEmail, "TopRight", evaluateRevisions, "BottomRight", ConnectorType.Line, "");

            connector = (base.CreateConnector(needsRevising, "Center", paywoll, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            connector = (base.CreateConnector(needsRevising, "Center", taxes, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            connector = (base.CreateConnector(needsRevising, "Center", controller, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            // create the legend as a group
            NGroup legend = new NGroup();

            NRectangleShape legendBackground = new NRectangleShape(0, 0, 1, 3);

            legendBackground.Style.FillStyle = new NColorFillStyle(Color.White);
            legend.Shapes.AddChild(legendBackground);

            NRectangleF bounds = new NRectangleF(0, 1, 1, 1);

            bounds.Inflate(-0.2f, -0.2f);

            NRectangleShape cpaItem = new NRectangleShape(bounds);

            cpaItem.Text           = "CPA";
            cpaItem.StyleSheetName = "CPA";
            legend.Shapes.AddChild(cpaItem);

            bounds = new NRectangleF(0, 2, 1, 1);
            bounds.Inflate(-0.2f, -0.2f);

            NRectangleShape clientItem = new NRectangleShape(bounds);

            clientItem.Text           = "Client";
            clientItem.StyleSheetName = "CLIENT";
            legend.Shapes.AddChild(clientItem);

            legend.UpdateModelBounds();
            legend.Bounds = base.GetGridCell(4, 0, 1, 1);

            document.ActiveLayer.AddChild(legend);
        }
示例#4
0
        private void CreateScene(NDrawingDocument document)
        {
            document.BackgroundStyle.FrameStyle.Visible = false;

            NFillStyle cpaFillStyle    = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(102, 204, 255), Color.FromArgb(0, 128, 128));
            NFillStyle clientFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(255, 102, 0), Color.FromArgb(255, 204, 0));
            NFillStyle stripeFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.FromArgb(221, 221, 221));
            NTextStyle abcTextStyle    = new NTextStyle(new Font("Arial", 12), Color.FromArgb(150, 150, 150));
            float      abcWidth        = 150;

            NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document);

            // configure the document
            helper.DefaultGridCellSize = new NSizeF(100, 70);
            helper.DefaultGridSpacing  = new NSizeF(30, 30);
            helper.DefaultGridOrigin   = new NPointF(60, 30);

            document.Bounds        = new NRectangleF(0, 0, 1000, (6 * helper.DefaultGridCellSize.Height) + (7 * helper.DefaultGridSpacing.Height));
            document.ShadowsZOrder = ShadowsZOrder.BehindLayer;

            // create the stripes
            NRectangleShape rect = new NRectangleShape(0, 0, document.Width, document.Height / 3);

            rect.Style.FillStyle   = (NFillStyle)stripeFillStyle.Clone();
            rect.Style.StrokeStyle = new NStrokeStyle(0, Color.White);
            document.ActiveLayer.AddChild(rect);

            rect = new NRectangleShape(0, document.Height / 3, document.Width, document.Height / 3);
            rect.Style.FillStyle   = (NFillStyle)stripeFillStyle.Clone();
            rect.Style.StrokeStyle = new NStrokeStyle(0, Color.White);
            document.ActiveLayer.AddChild(rect);

            rect = new NRectangleShape(0, 2 * document.Height / 3, document.Width, document.Height / 3);
            rect.Style.FillStyle   = (NFillStyle)stripeFillStyle.Clone();
            rect.Style.StrokeStyle = new NStrokeStyle(0, Color.White);
            document.ActiveLayer.AddChild(rect);

            // create A,B,C texts
            NTextShape text = new NTextShape("A", document.Width - abcWidth, 0, abcWidth, document.Height / 3);

            text.Mode            = BoxTextMode.Stretch;
            text.Style.TextStyle = (abcTextStyle.Clone() as NTextStyle);
            document.ActiveLayer.AddChild(text);

            text                 = new NTextShape("B", document.Width - abcWidth, document.Height / 3, abcWidth, document.Height / 3);
            text.Mode            = BoxTextMode.Stretch;
            text.Style.TextStyle = (abcTextStyle.Clone() as NTextStyle);
            document.ActiveLayer.AddChild(text);

            text                 = new NTextShape("C", document.Width - abcWidth, 2 * document.Height / 3, abcWidth, document.Height / 3);
            text.Mode            = BoxTextMode.Stretch;
            text.Style.TextStyle = (abcTextStyle.Clone() as NTextStyle);
            document.ActiveLayer.AddChild(text);

            // add stripe texts
            text = new NTextShape("Sing up client", document.Width - abcWidth, document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            text = new NTextShape("Monthly Accounting Services", document.Width - abcWidth, 2 * document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            text = new NTextShape("Additional Services", document.Width - abcWidth, 3 * document.Height / 3 - 50, abcWidth, 50);
            document.ActiveLayer.AddChild(text);

            // create a layer for the forground shapes
            NLayer layer = new NLayer();

            document.Layers.AddChild(layer);
            document.ActiveLayerUniqueId = layer.UniqueId;
            layer.Style.ShadowStyle      = new NShadowStyle(ShadowType.GaussianBlur,
                                                            Color.Gray,
                                                            new Nevron.GraphicsCore.NPointL(5, 5),
                                                            1,
                                                            new NLength(10));

            // shapes in row 1
            NShape newClient                  = helper.CreateBasicShape(BasicShapes.Diamond, helper.GetGridCell(0, 0), "New Client", cpaFillStyle);
            NShape register                   = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(0, 1), "Register", cpaFillStyle);
            NShape clientAccountInfo          = helper.CreateFlowChartingShape(FlowChartingShapes.Data, helper.GetGridCell(0, 2), "Client account info", cpaFillStyle);
            NShape explainDataEntryProcedures = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(0, 3), "Explain data entry procedures", cpaFillStyle);

            // shapes in row 2
            NShape dataEntry         = helper.CreateFlowChartingShape(FlowChartingShapes.ManualInput, helper.GetGridCell(2, 0), "Data Entry", clientFillStyle);
            NShape emailCompleted    = helper.CreateFlowChartingShape(FlowChartingShapes.Document, helper.GetGridCell(2, 1), "E-mail Completed", clientFillStyle);
            NShape review            = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(2, 2), "Review", cpaFillStyle);
            NShape needsRevising     = helper.CreateBasicShape(BasicShapes.Diamond, helper.GetGridCell(2, 3), "Needs revising", cpaFillStyle);
            NShape emailRevisions    = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(2, 4), "E-mail revisions", cpaFillStyle);
            NShape evaluateRevisions = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(2, 5), "Evaluate revisions", clientFillStyle);

            // shapes in row 3
            NShape emailApprovedRevisions = helper.CreateFlowChartingShape(FlowChartingShapes.Document, helper.GetGridCell(3, 2), "E-mail Approved Revisions", clientFillStyle);
            NShape evaluateRevisions2     = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(3, 4), "Evaluate Revisions", clientFillStyle);
            NShape answerClientEmail      = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(3, 5), "Answer Client E-mail", cpaFillStyle);

            // shapes in row 4
            NShape paywoll    = helper.CreateFlowChartingShape(FlowChartingShapes.Document, helper.GetGridCell(5, 2), "Payroll", clientFillStyle);
            NShape taxes      = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(5, 3), "Taxes", clientFillStyle);
            NShape controller = helper.CreateBasicShape(BasicShapes.Rectangle, helper.GetGridCell(5, 4), "Controller", cpaFillStyle);

            // create the optional ports of the shape
            evaluateRevisions.CreateShapeElements(ShapeElementsMask.Ports);

            // some shapes need to have extra ports
            NRotatedBoundsPort port = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(-25, 50));

            port.Name = "BottomLeft";
            evaluateRevisions.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(evaluateRevisions.UniqueId, new NContentAlignment(+25, 50));
            port.Name = "BottomRight";
            evaluateRevisions.Ports.AddChild(port);

            // create the optional ports of the shape
            answerClientEmail.CreateShapeElements(ShapeElementsMask.Ports);

            port      = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(-25, -50));
            port.Name = "TopLeft";
            answerClientEmail.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(answerClientEmail.UniqueId, new NContentAlignment(+25, -50));
            port.Name = "TopRight";
            answerClientEmail.Ports.AddChild(port);

            // connect shapes in levels
            helper.CreateConnector(newClient, "Center", register, "Center", ConnectorType.Line, "YES");
            helper.CreateConnector(register, "Center", clientAccountInfo, "Center", ConnectorType.Line, "");
            helper.CreateConnector(clientAccountInfo, "Center", explainDataEntryProcedures, "Center", ConnectorType.Line, "");

            helper.CreateConnector(dataEntry, "Center", emailCompleted, "Center", ConnectorType.Line, "");
            helper.CreateConnector(emailCompleted, "Center", review, "Center", ConnectorType.Line, "");
            helper.CreateConnector(review, "Center", needsRevising, "Center", ConnectorType.Line, "");
            helper.CreateConnector(needsRevising, "Center", emailRevisions, "Center", ConnectorType.Line, "YES");
            helper.CreateConnector(emailRevisions, "Center", evaluateRevisions, "Center", ConnectorType.Line, "");

            helper.CreateConnector(evaluateRevisions2, "Center", emailApprovedRevisions, "Center", ConnectorType.Line, "");

            // connect accross levels
            NStep3Connector connector = (helper.CreateConnector(newClient, "Center", dataEntry, "Center", ConnectorType.SideToSide, "NO") as NStep3Connector);

            connector.UseMiddleControlPointPercent = false;
            connector.MiddleControlPointOffset     = -50;

            helper.CreateConnector(explainDataEntryProcedures, "Center", dataEntry, "Center", ConnectorType.TopToBottom, "");

            helper.CreateConnector(emailApprovedRevisions, "Center", review, "Center", ConnectorType.Line, "");
            helper.CreateConnector(emailRevisions, "Center", evaluateRevisions2, "Center", ConnectorType.Line, "");
            helper.CreateConnector(evaluateRevisions, "BottomLeft", answerClientEmail, "TopLeft", ConnectorType.Line, "");
            helper.CreateConnector(answerClientEmail, "TopRight", evaluateRevisions, "BottomRight", ConnectorType.Line, "");

            connector = (helper.CreateConnector(needsRevising, "Center", paywoll, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;
            connector = (helper.CreateConnector(needsRevising, "Center", taxes, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;
            connector = (helper.CreateConnector(needsRevising, "Center", controller, "Center", ConnectorType.TopToBottom, "") as NStep3Connector);
            connector.MiddleControlPointPercent = 66;

            // create the legend
            NGroup legend = new NGroup();

            NRectangleShape ledendBackground = new NRectangleShape(0, 0, 1, 3);

            ledendBackground.Style.FillStyle = new NColorFillStyle(Color.White);
            legend.Shapes.AddChild(ledendBackground);

            NTextShape legendTitle = new NTextShape("Legend", 0, 0, 1, 1);

            legend.Shapes.AddChild(legendTitle);

            NRectangleF bounds = new NRectangleF(0, 1, 1, 1);

            bounds.Inflate(-0.2f, -0.2f);

            NShape shape = helper.CreateBasicShape(BasicShapes.Rectangle, bounds, "CPA", (NFillStyle)cpaFillStyle.Clone(), false);

            legend.Shapes.AddChild(shape);

            bounds = new NRectangleF(0, 2, 1, 1);
            bounds.Inflate(-0.2f, -0.2f);

            shape = helper.CreateBasicShape(BasicShapes.Rectangle, bounds, "Client", (NFillStyle)clientFillStyle.Clone(), false);
            legend.Shapes.AddChild(shape);

            legend.UpdateModelBounds();
            legend.Bounds = helper.GetGridCell(4, 0, 1, 1);

            document.ActiveLayer.AddChild(legend);
        }