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; }
private void CreateGroupPorts(NGroup group) { group.CreateShapeElements(ShapeElementsMask.Ports); // create a dynamic port anchored to the center of the shape NRotatedBoundsPort port = new NRotatedBoundsPort(new NContentAlignment(ContentAlignment.TopCenter)); port.Name = "port"; group.Ports.AddChild(port); }
private void OnEdgeImported(NDataSourceImporter dataSourceImporter, NShape shape, INDataRecord dataRecord) { // Set the text of the edge shape.Text = dataRecord.GetColumnValue("Desc").ToString(); // Get the symbol name if any object symbol = dataRecord.GetColumnValue("Symbol"); if (symbol == null || Convert.IsDBNull(symbol)) { return; } // Add a logical line port NLogicalLinePort linePort = new NLogicalLinePort(20); shape.CreateShapeElements(ShapeElementsMask.Ports); shape.Ports.AddChild(linePort); // Attach a custom shape based on the symbol name NShape customShape = null; switch (symbol.ToString()) { case "Stop": customShape = m_BusinessProcessShapesFactory.CreateShape(BusinessProcessShapes.StopAccepted); break; case "Question": customShape = m_BusinessProcessShapesFactory.CreateShape(BusinessProcessShapes.Question); break; } ((NDrawingDocument)shape.Document).ActiveLayer.AddChild(customShape); // Protect the symbol from user interactions NAbilities protection = customShape.Protection; protection.All = true; customShape.Protection = protection; // Add an outward port to the shape NRotatedBoundsPort outwardPort = new NRotatedBoundsPort(new NContentAlignment(ContentAlignment.MiddleCenter)); outwardPort.Type = PortType.Outward; customShape.CreateShapeElements(ShapeElementsMask.Ports); customShape.Ports.AddChild(outwardPort); outwardPort.Connect(linePort); }
private void alignmentComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { if (alignmentComboBox.SelectedItem == null) { return; } if (EventsHandlingPaused) { return; } // get the selected shape NShape shape = view.Selection.AnchorNode as NShape; if (shape == null || shape.Ports == null) { return; } PauseEventsHandling(); // alter the alignment of a bounds or rotated bounds port NBoundsPort boundsPort = shape.Ports.DefaultInwardPort as NBoundsPort; if (boundsPort != null) { boundsPort.Alignment = new NContentAlignment((ContentAlignment)alignmentComboBox.SelectedItem); } else { NRotatedBoundsPort rotatedBoundsPort = (shape.Ports.DefaultInwardPort as NRotatedBoundsPort); if (rotatedBoundsPort != null) { rotatedBoundsPort.Alignment = new NContentAlignment((ContentAlignment)alignmentComboBox.SelectedItem); } } ResumeEventsHandling(); document.SmartRefreshAllViews(); }
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); }
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); }
private void InitDocument() { // modify the connectors style sheet NStyleSheet styleSheet = (NDrawingView1.Document.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet); NTextStyle textStyle = new NTextStyle(); textStyle.BackplaneStyle.Visible = true; textStyle.BackplaneStyle.StandardFrameStyle.InnerBorderWidth = new NLength(0); textStyle.BackplaneStyle.FillStyle = new NColorFillStyle(Color.FromArgb(200, Color.White)); styleSheet.Style.TextStyle = textStyle; styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black); styleSheet.Style.StartArrowheadStyle.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.Black)); styleSheet.Style.StartArrowheadStyle.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White)); styleSheet.Style.EndArrowheadStyle.StrokeStyle = new NStrokeStyle(1, Color.Black); // modify default stroke style NDrawingView1.Document.Style.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.White)); // configure the document NDrawingView1.Document.Bounds = new NRectangleF(0, 0, 420, 320); NDrawingView1.Document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; NDrawingView1.Document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; NDrawingView1.Document.GraphicsSettings.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; NDrawingView1.Document.MeasurementUnit = NGraphicsUnit.Pixel; NDrawingView1.Document.DrawingScaleMode = DrawingScaleMode.NoScale; NDrawingView1.Document.BackgroundStyle.FrameStyle.Visible = false; // predefined styles NAdvancedGradientFillStyle ag1 = new NAdvancedGradientFillStyle(); ag1.BackgroundColor = Color.Navy; ag1.Points.Add(new NAdvancedGradientPoint(Color.SkyBlue, 50, 50, 0, 79, AGPointShape.Circle)); NAdvancedGradientFillStyle ag2 = new NAdvancedGradientFillStyle(); ag2.BackgroundColor = Color.DarkRed; ag2.Points.Add(new NAdvancedGradientPoint(Color.Red, 50, 50, 0, 71, AGPointShape.Circle)); NAdvancedGradientFillStyle ag3 = new NAdvancedGradientFillStyle(); ag3.BackgroundColor = Color.Orange; ag3.Points.Add(new NAdvancedGradientPoint(Color.Yellow, 50, 50, 0, 50, AGPointShape.Circle)); // shapes NBasicShapesFactory factory = new NBasicShapesFactory(NDrawingView1.Document); NEllipseShape centerEllipse = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; centerEllipse.Name = "CenterEllipse"; centerEllipse.Width = 50f; centerEllipse.Height = 50f; centerEllipse.Center = new NPointF(210, 160); centerEllipse.Style.StrokeStyle = null; centerEllipse.Style.FillStyle = ag3; centerEllipse.Style.InteractivityStyle = new NInteractivityStyle(true, centerEllipse.Name); NEllipseShape rotatingEllipse = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; rotatingEllipse.Name = "RotatingEllipse"; rotatingEllipse.Width = 35f; rotatingEllipse.Height = 35f; rotatingEllipse.Center = new NPointF(centerEllipse.Bounds.X - 100, centerEllipse.Center.Y); rotatingEllipse.Style.StrokeStyle = null; rotatingEllipse.Style.FillStyle = ag1; rotatingEllipse.PinPoint = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y); rotatingEllipse.Style.InteractivityStyle = new NInteractivityStyle(true, rotatingEllipse.Name); NEllipseShape rotatingEllipse2 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; rotatingEllipse2.Name = "RotatingEllipse2"; rotatingEllipse2.Width = 15f; rotatingEllipse2.Height = 15f; rotatingEllipse2.Center = new NPointF(centerEllipse.Bounds.Right + 30, centerEllipse.Center.Y); rotatingEllipse2.Style.StrokeStyle = null; rotatingEllipse2.Style.FillStyle = ag2; rotatingEllipse2.PinPoint = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y); rotatingEllipse2.Style.InteractivityStyle = new NInteractivityStyle(true, rotatingEllipse2.Name); NEllipseShape orbit1 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; orbit1.Name = "orbit1"; orbit1.Width = 2 * (centerEllipse.Center.X - rotatingEllipse.Center.X); orbit1.Height = orbit1.Width; orbit1.Center = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y); orbit1.Style.StrokeStyle = new NStrokeStyle(Color.Black); orbit1.Style.StrokeStyle.Pattern = LinePattern.Dot; orbit1.Style.StrokeStyle.Factor = 2; orbit1.Style.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White)); NEllipseShape orbit2 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; orbit2.Name = "orbit2"; orbit2.Width = 2 * (centerEllipse.Center.X - rotatingEllipse2.Center.X); orbit2.Height = orbit2.Width; orbit2.Center = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y); orbit2.Style.StrokeStyle = new NStrokeStyle(Color.Black); orbit2.Style.StrokeStyle.Pattern = LinePattern.Dot; orbit2.Style.StrokeStyle.Factor = 2; orbit2.Style.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White)); NDrawingView1.Document.ActiveLayer.AddChild(orbit1); NDrawingView1.Document.ActiveLayer.AddChild(orbit2); NDrawingView1.Document.ActiveLayer.AddChild(centerEllipse); NDrawingView1.Document.ActiveLayer.AddChild(rotatingEllipse); NDrawingView1.Document.ActiveLayer.AddChild(rotatingEllipse2); // some shapes need to have extra ports NRotatedBoundsPort port = new NRotatedBoundsPort(centerEllipse.UniqueId, ContentAlignment.MiddleCenter); port.Name = "MiddleCenter"; centerEllipse.Ports.AddChild(port); port = new NRotatedBoundsPort(rotatingEllipse.UniqueId, ContentAlignment.MiddleCenter); port.Name = "MiddleCenter"; rotatingEllipse.Ports.AddChild(port); // connect shapes in levels NShape connector = base.CreateConnector(NDrawingView1.Document, centerEllipse, "MiddleCenter", rotatingEllipse, "MiddleCenter", ConnectorType.Line, "Radius"); NInteractivityStyle istyle = connector.ComposeInteractivityStyle(); }
protected NCompositeShape CreateCoffeeCupShape(NPointF location, float scale) { NCompositeShape shape = new NCompositeShape(); // create the cup as a polygon path NPolygonPath cup = new NPolygonPath(new NPointF[] { new NPointF(45, 268), new NPointF(63, 331), new NPointF(121, 331), new NPointF(140, 268) }); shape.Primitives.AddChild(cup); // create the cup hangle as a closed curve path NClosedCurvePath handle = new NClosedCurvePath(new NPointF[] { new NPointF(175, 295), new NPointF(171, 278), new NPointF(140, 283), new NPointF(170, 290), new NPointF(128, 323) }, 1); NStyle.SetFillStyle(handle, new NColorFillStyle(Color.LightSalmon)); shape.Primitives.AddChild(handle); // create the steam as a custom filled path GraphicsPath path = new GraphicsPath(); path.AddBeziers(new PointF[] { new PointF(92, 258), new PointF(53, 163), new PointF(145, 160), new PointF(86, 50), new PointF(138, 194), new PointF(45, 145), new PointF(92, 258) }); path.CloseAllFigures(); NCustomPath steam = new NCustomPath(path, PathType.ClosedFigure); NStyle.SetFillStyle(steam, new NColorFillStyle(Color.FromArgb(50, 122, 122, 122))); shape.Primitives.AddChild(steam); // update the shape model bounds to fit the primitives it contains shape.UpdateModelBounds(); // create the shape ports shape.CreateShapeElements(ShapeElementsMask.Ports); // create dynamic port anchored to the cup center NDynamicPort dynamicPort = new NDynamicPort(cup.UniqueId, ContentAlignment.MiddleCenter, DynamicPortGlueMode.GlueToContour); shape.Ports.AddChild(dynamicPort); // create rotated bounds port anchored to the middle right side of the handle NRotatedBoundsPort rotatedBoundsPort = new NRotatedBoundsPort(handle.UniqueId, ContentAlignment.MiddleRight); shape.Ports.AddChild(rotatedBoundsPort); // apply style to the shape shape.Style.FillStyle = new NColorFillStyle(Color.LightCoral); // position it and scale the shape shape.Location = location; shape.Width = shape.Width * scale; shape.Height = shape.Height * scale; return(shape); }
protected NCompositeShape CreateOrgChartShape(NPersonalInfo info) { NRectangleF bounds = info.Bounds; float bottomPortAlignment = info.BottomPortAlignment; Bitmap photo = new Bitmap(this.MapPathSecure(info.Picture)); // compose a new graph vertex from a frame and an image NRectanglePath frame = new NRectanglePath(bounds); NRectanglePath image = new NRectanglePath(new NPointF(bounds.X + 5, bounds.Y + 5), new NSizeF(photo.Size)); NImageFillStyle imgageFillStyle = new NImageFillStyle(photo, 0xff); NStyle.SetFillStyle(image, imgageFillStyle); NCompositeShape shape = new NCompositeShape(); shape.Primitives.AddChild(frame); shape.Primitives.AddChild(image); shape.UpdateModelBounds(); Document.ActiveLayer.AddChild(shape); // set the vertex fill style NColorFillStyle fillStyle = null; switch (info.Level) { case 0: fillStyle = new NColorFillStyle(Color.FromArgb(241, 100, 34)); break; case 1: fillStyle = new NColorFillStyle(Color.FromArgb(249, 167, 26)); break; case 2: fillStyle = new NColorFillStyle(Color.FromArgb(255, 247, 151)); break; } fillStyle.ImageFiltersStyle.Filters.Add(new NLightingImageFilter()); shape.Style.FillStyle = fillStyle; NInteractivityStyle interactivityStyle = new NInteractivityStyle(); interactivityStyle.Tooltip.Text = "Click to show " + info.Name + " personal information"; interactivityStyle.UrlLink.Url = "../Examples/WebControl/GettingStarted/NPersonalInfoPage.aspx?" + info.Id.ToString(); shape.Style.InteractivityStyle = interactivityStyle; // add a new label for the person name NRotatedBoundsLabel nameLabel = new NRotatedBoundsLabel(info.Name, shape.UniqueId, new Nevron.Diagram.NMargins(40, 1, 50, 1)); shape.Labels.AddChild(nameLabel); NStyle.SetTextStyle(nameLabel, nameLabel.ComposeTextStyle().Clone() as NTextStyle); nameLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right; nameLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Top; // configure default label (used for the person position) NRotatedBoundsLabel positionLabel = shape.Labels.DefaultLabel as NRotatedBoundsLabel; NStyle.SetTextStyle(positionLabel, positionLabel.ComposeTextStyle().Clone() as NTextStyle); positionLabel.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial", 10, FontStyle.Bold)); positionLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right; positionLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Bottom; positionLabel.Margins = new Nevron.Diagram.NMargins(40, 5, 1, 50); positionLabel.Text = info.Position; // create the optional ports of the shape shape.CreateShapeElements(ShapeElementsMask.Ports); // add rotated bounds ports NPort leftPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleLeft)); leftPort.Name = "Left"; shape.Ports.AddChild(leftPort); NPort rightPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleRight)); rightPort.Name = "Right"; shape.Ports.AddChild(rightPort); NPort topPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.TopCenter)); topPort.Name = "Top"; shape.Ports.AddChild(topPort); NRotatedBoundsPort bottomPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(bottomPortAlignment, 50)); bottomPort.Name = "Bottom"; shape.Ports.AddChild(bottomPort); return(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); }
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); }