private void CreateScene(NDrawingDocument document) { document.BackgroundStyle.FrameStyle.Visible = false; document.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial Narrow", 8)); NNetworkShapesFactory factory = new NNetworkShapesFactory(document); factory.DefaultSize = new NSizeF(240, 180); NShape server = factory.CreateShape(NetworkShapes.Server); NShape computer = factory.CreateShape(NetworkShapes.Computer); NShape laptop = factory.CreateShape(NetworkShapes.Laptop); document.ActiveLayer.AddChild(server); document.ActiveLayer.AddChild(computer); document.ActiveLayer.AddChild(laptop); NRoutableConnector link1 = new NRoutableConnector(); document.ActiveLayer.AddChild(link1); link1.FromShape = server; link1.ToShape = computer; NRoutableConnector link2 = new NRoutableConnector(); document.ActiveLayer.AddChild(link2); link2.FromShape = server; link2.ToShape = laptop; // layout the shapes in the active layer using a table layout NLayeredGraphLayout layout = new NLayeredGraphLayout(); // get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // resize document to fit all shapes document.SizeToContent(); // add the data shape const float shapeSize = 10; NEllipseShape data = new NEllipseShape(link2.EndPoint.X - shapeSize / 2, link2.EndPoint.Y - shapeSize, shapeSize, shapeSize); document.ActiveLayer.AddChild(data); NStyle.SetStrokeStyle(data, new NStrokeStyle(0, KnownArgbColorValue.Transparent)); NStyle.SetFillStyle(data, new NColorFillStyle(KnownArgbColorValue.Red)); // set the animations style SetAnimationsStyle(data, link1, link2); // resize document to fit all shapes document.SizeToContent(); }
private void InitDocument(NDrawingDocument document) { // Remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // Adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; // Set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(192, 194, 194), Color.FromArgb(129, 133, 133)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); // Create a graph CreateGraph(document); // Create the layout NLayeredGraphLayout layout = new NLayeredGraphLayout(); // Get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NDrawingDocument document = diagramControl.Document; NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); Dictionary <string, string> settings = helper.ParseSettings(argument); // Create and configure the layout NSingleCycleLayout layout = new NSingleCycleLayout(); helper.ConfigureLayout(layout, settings); // Get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); // Update the view diagramControl.UpdateView(); }
private void InitDocument() { NDrawingDocument document = NDrawingView1.Document; // remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; // set up visual formatting document.Style.FillStyle = new NColorFillStyle(Color.Linen); document.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); // adjust the text properties NDrawingView1.Document.Style.TextStyle.FontStyle = new NFontStyle("arial", 15f); // create the initial diagram CreatePredefinedGraph(); PerformLayout(null); // resize document to fit all shapes document.SizeToContent(); }
private void InitDocument(NDrawingDocument document) { // Remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // Adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; // Set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(251, 203, 156), Color.FromArgb(247, 150, 56)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); NStyleSheet sheet = new NStyleSheet("edges"); sheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); sheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.StyleSheets.AddChild(sheet); // Create the initial diagram DiagramRenderer renderer = new DiagramRenderer(); renderer.CreateRandomDiagram(document, 15, 15); // Layout the diagram renderer.ApplyLayout(document, null); // Resize document to fit all shapes document.SizeToContent(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NDrawingDocument document = diagramControl.Document; NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); Dictionary <string, string> settings = helper.ParseSettings(argument); DiagramRenderer renderer = new DiagramRenderer(); switch (settings["command"]) { case "RandomTree6Levels": renderer.CreateTree(document, 6, 3); break; case "RandomTree8Levels": renderer.CreateTree(document, 8, 2); break; } // Layout the diagram renderer.ApplyLayout(document, settings); // Resize document to fit all shapes document.SizeToContent(); // Update the view diagramControl.UpdateView(); }
protected void InitDocument(NDrawingDocument document) { // Remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // Adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; // Set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(192, 194, 194), Color.FromArgb(129, 133, 133)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); NStyleSheet sheet = new NStyleSheet("edges"); sheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); sheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.StyleSheets.AddChild(sheet); // Create a tree DiagramRenderer renderer = new DiagramRenderer(); renderer.CreateTree(document, 6, 3); // Apply the layout renderer.ApplyLayout(document, null); // Resize document to fit all shapes document.SizeToContent(); }
protected void InitDocument(NDrawingDocument document) { // Remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // Adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; // Set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(251, 203, 156), Color.FromArgb(247, 150, 56)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); NStyleSheet sheet = new NStyleSheet("edges"); sheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); sheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.StyleSheets.AddChild(sheet); // Create a tree CreateTree(); // Create the layout NBalloonTreeLayout layout = new NBalloonTreeLayout(); // Get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NDrawingDocument document = diagramControl.Document; NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); Dictionary <string, string> settings = helper.ParseSettings(argument); // Create and configure the layout NSpringLayout layout = new NSpringLayout(); layout.BounceBackForce.Padding = 100f; layout.GravityForce.AttractionCoefficient = 0.2f; layout.BounceBackForce.Enabled = Boolean.Parse(settings["BounceBackForce"]); layout.GravityForce.Enabled = Boolean.Parse(settings["GravityForce"]); layout.ElectricalForce.NominalDistance = Single.Parse(settings["NominalDistance"]); layout.SpringForce.LogBase = helper.ParseFloat(settings["LogBase"]); layout.SpringForce.SpringForceLaw = (SpringForceLaw)Enum.Parse(typeof(SpringForceLaw), settings["SpringForceLaw"]); // Get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); // Update the view diagramControl.UpdateView(); }
protected void InitDocument(NDrawingDocument document) { document.BackgroundStyle.FrameStyle.Visible = false; document.AutoBoundsPadding = new Nevron.Diagram.NMargins(10f, 10f, 10f, 10f); document.Style.FillStyle = new NColorFillStyle(Color.White); NBasicShapesFactory factory = new NBasicShapesFactory(document); NShape outerCircle = factory.CreateShape(BasicShapes.Circle); outerCircle.Bounds = new NRectangleF(0f, 0f, 200f, 200f); document.ActiveLayer.AddChild(outerCircle); NShape rect = factory.CreateShape(BasicShapes.Rectangle); rect.Bounds = new NRectangleF(42f, 42f, 50f, 50f); rect.Style.FillStyle = new NColorFillStyle(Color.Orange); document.ActiveLayer.AddChild(rect); NShape triangle = factory.CreateShape(BasicShapes.Triangle); triangle.Bounds = new NRectangleF(121f, 57f, 60f, 55f); triangle.Style.FillStyle = new NColorFillStyle(Color.LightGray); document.ActiveLayer.AddChild(triangle); NShape pentagon = factory.CreateShape(BasicShapes.Pentagon); pentagon.Bounds = new NRectangleF(60f, 120f, 54f, 50f); pentagon.Style.FillStyle = new NColorFillStyle(Color.WhiteSmoke); document.ActiveLayer.AddChild(pentagon); document.SizeToContent(); }
public void InitDocument(NDrawingDocument document, NMapProjection mapProjection) { document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.Bounds = new NRectangleF(0, 0, 5000, 5000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; // Add the countries shape file NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(CountriesShapefileName)); countries.NameColumn = "NAME"; mapImporter.AddLayer(countries); // Read the map data mapImporter.Read(); mapImporter.Projection = mapProjection; mapImporter.Parallels.ArcRenderMode = ArcRenderMode.Fine; mapImporter.Meridians.ArcRenderMode = ArcRenderMode.Fine; // Add a fill rule countries.FillRule = new NMapFillRuleValue("ISO_NUM", MapColors); // Import the map mapImporter.Import(document, document.Bounds); // Size the document to content document.SizeToContent(); }
private void LoadMap(NDrawingDocument document, string fileName, string nameColumn, string textColumn, string toolTipColumn, float width, float height) { document.Layers.RemoveAllChildren(); document.Width = width; document.Height = height; NEsriMapImporter mapImporter = new NEsriMapImporter(); // Create the STATES shape file NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(fileName)); countries.NameColumn = nameColumn; countries.TextColumn = textColumn; mapImporter.AddLayer(countries); // Import the map mapImporter.Read(); if (String.IsNullOrEmpty(toolTipColumn) == false) { mapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(toolTipColumn); } mapImporter.Import(document, document.Bounds); document.SizeToContent(); }
protected void Page_Load(object sender, System.EventArgs e) { // begin view init base.DefaultGridOrigin = new NPointF(-100, 0); base.DefaultGridCellSize = new NSizeF(100, 50); base.DefaultGridSpacing = new NSizeF(50, 40); if (!NThinDiagramControl1.Initialized) { // begin view init NDrawingDocument document = NThinDiagramControl1.Document; NThinDiagramControl1.Controller.Tools.Add(new NTooltipTool()); NThinDiagramControl1.Controller.Tools.Add(new NCursorTool()); NThinDiagramControl1.Controller.Tools.Add(new NRectZoomTool()); NPanTool panTool = new NPanTool(); panTool.Enabled = false; NThinDiagramControl1.Controller.Tools.Add(panTool); // configure the toolbar NThinDiagramControl1.Toolbar.Visible = true; NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NSaveStateAction("DiagramState.ndx", Serialization.PersistencyFormat.XML))); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NSaveImageAction("DiagramPDF", new NPdfImageFormat(), true, new NSize(), 300))); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NSaveImageAction("DiagramPNG", new NPngImageFormat(), true, new NSize(), 96))); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarSeparator()); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NZoomInAction())); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NZoomOutAction())); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarSeparator()); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NTogglePanToolAction())); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleRectZoomToolAction())); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarSeparator()); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleTooltipToolAction())); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleCursorToolAction())); NThinDiagramControl1.Toolbar.Items.Add(new NToolbarSeparator()); Array values = Enum.GetValues(typeof(CanvasLayout)); for (int i = 0; i < values.Length; i++) { NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleViewLayoutAction((CanvasLayout)values.GetValue(i)))); } // init NDrawingView1.Document. document.BeginInit(); InitDocument(document); document.SizeToContent(); document.EndInit(); // NThinDiagramControl1.View.Layout = CanvasLayout.Fit; NThinDiagramControl1.View.ZoomFactor = 2; NThinDiagramControl1.View.MinZoomFactor = 1; NThinDiagramControl1.View.MaxZoomFactor = 10; NThinDiagramControl1.View.ZoomPercent = 50; // NThinDiagramControl1.View.ViewportOrigin = document.Location; } }
public void InitDocument(NDrawingDocument document, NDataGrouping dataGrouping) { document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.RoutingManager.Enabled = false; document.BridgeManager.Enabled = false; document.Bounds = new NRectangleF(0, 0, 5000, 5000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(CountriesShapefileName)); countries.NameColumn = "NAME"; countries.TextColumn = "NAME"; mapImporter.AddLayer(countries); mapImporter.Read(); // Load the data DataSet dataSet = new DataSet(); dataSet.ReadXml(HttpContext.Current.Server.MapPath(SalesXmlFileName), XmlReadMode.ReadSchema); // Create a data binding source NMapDataTableBindingSource source = new NMapDataTableBindingSource(dataSet.Tables["Sales"]); // Create a data binding context NMapDataBindingContext context = new NMapDataBindingContext(); context.AddColumnMatching("NAME", "Country"); context.ColumnsToImport.Add("Sales"); // Perform the data binding countries.DataBind(source, context); // Add a fill rule NMapFillRuleRange fillRule = new NMapFillRuleRange("Sales", Color.White, Color.DarkGreen, 8); fillRule.DataGrouping = dataGrouping; countries.FillRule = fillRule; mapImporter.Import(document, document.Bounds); // Generate the legend NMapLegendRange mapLegend = (NMapLegendRange)mapImporter.GetLegend(fillRule); mapLegend.Title = "Sales"; mapLegend.RangeFormatString = "{0:N0} - {1:N0} million dollars"; mapLegend.LastFormatString = "{0:N0} million dollars and more"; NMapLegendRenderPage.MapLegend = mapLegend; document.SizeToContent(); }
private void InitDocument() { NDrawingDocument document = NDrawingView1.Document; // change default document styles document.Style.TextStyle.TextFormat = TextFormat.XML; document.Style.StartArrowheadStyle.Shape = ArrowheadShape.None; document.Style.EndArrowheadStyle.Shape = ArrowheadShape.None; document.BackgroundStyle.FrameStyle.Visible = false; // configure shadow (inherited by all objects) document.Style.ShadowStyle = new NShadowStyle( ShadowType.GaussianBlur, Color.FromArgb(150, Color.Black), new NPointL(3, 3), 1, new NLength(4)); document.ShadowsZOrder = ShadowsZOrder.BehindDocument; // create the data importer string databasePath = HttpContext.Current.Server.MapPath(@"..\App_Data\OrgData.xml"); NTreeDataSourceImporter treeImporter = new NTreeDataSourceImporter(); treeImporter.Document = document; DataSet dataSet = new DataSet(); dataSet.ReadXml(databasePath, XmlReadMode.ReadSchema); treeImporter.DataSource = dataSet.Tables["Employees"]; // records are uniquely identified by their Id column // records link to their parent record by their ParentId column treeImporter.IdColumnName = "Id"; treeImporter.ParentIdColumnName = "ParentId"; treeImporter.CollapsibleSubtrees = true; treeImporter.VertexShapesFactory = new NBasicShapesFactory(); treeImporter.VertexShapesName = BasicShapes.Table.ToString(); // use tip over tree layout NTipOverTreeLayout tipOverLayout = new NTipOverTreeLayout(); tipOverLayout.ColRightParentPlacement.Offset = 70; tipOverLayout.HorizontalSpacing = 30; tipOverLayout.LeafsPlacement = TipOverChildrenPlacement.ColRight; treeImporter.Layout = tipOverLayout; // import the shapes treeImporter.VertexImported += new ShapeImportedDelegate(treeImporter_VertexImported); bool ok = treeImporter.Import(); // resize document to fit all shapes document.SizeToContent(); }
public void InitDocument(NDrawingDocument document, NDataGrouping dataGrouping) { // Configure the drawing document document.Layers.RemoveAllChildren(); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.RoutingManager.Enabled = false; document.BridgeManager.Enabled = false; document.Bounds = new NRectangleF(0, 0, 5000, 5000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); // Add a style sheet NStyleSheet styleSheet = new NStyleSheet(WhiteTextStyleSheetName); NTextStyle textStyle = (NTextStyle)document.ComposeTextStyle().Clone(); textStyle.FillStyle = new NColorFillStyle(KnownArgbColorValue.White); NStyle.SetTextStyle(styleSheet, textStyle); document.StyleSheets.AddChild(styleSheet); // Create a map importer NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; // Add a shapefile NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(CountriesShapefileName)); countries.NameColumn = "NAME"; countries.TextColumn = "NAME"; mapImporter.AddLayer(countries); // Read the map data mapImporter.Read(); // Create a fill rule NMapFillRuleRange fillRule = new NMapFillRuleRange("POP_1994", Color.White, Color.Black, 12); fillRule.DataGrouping = dataGrouping; countries.FillRule = fillRule; // Associate a shape created listener and import the map data mapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); mapImporter.Import(document, document.Bounds); // Generate a legend NMapLegendRange mapLegend = (NMapLegendRange)mapImporter.GetLegend(fillRule); mapLegend.Title = "Population (thousands people)"; mapLegend.RangeFormatString = "{0:#,###,##0,} - {1:#,###,##0,}"; mapLegend.LastFormatString = "more than {0:#,###,##0,}"; NMapLegendRenderPage.MapLegend = mapLegend; document.SizeToContent(); }
private List <NCityInfo> InitDocument(NDrawingDocument document) { document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.Bounds = new NRectangleF(0, 0, 5000, 5000); document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightBlue); CreateStyleSheets(document); CreateStarPointShape(document); NEsriMapImporter mapImporter = new NEsriMapImporter(); mapImporter.MapBounds = NMapBounds.World; // Add the countries shape file NEsriShapefile countries = new NEsriShapefile(HttpContext.Current.Server.MapPath(CountriesShapefileName)); countries.NameColumn = "NAME"; countries.TextColumn = "NAME"; countries.MaxTextShowZoomFactor = 0.99f; mapImporter.AddLayer(countries); // Add the cities shape file NEsriShapefile cities = new NEsriShapefile(HttpContext.Current.Server.MapPath(CitiesShapefileName)); cities.NameColumn = "NAME"; cities.TextColumn = "NAME"; cities.MinShowZoomFactor = 1.0f; cities.PointSizeColumn = "POPULATION"; cities.MinPointShapeSize = new NSizeF(10, 10); cities.MaxPointShapeSize = new NSizeF(40, 40); mapImporter.AddLayer(cities); // Read the map data mapImporter.Read(); // Set a fill rule for the countries countries.FillRule = new NMapFillRuleValue("ISO_NUM", MapColors); // Add a shape created listener mapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener(); // Import the map mapImporter.Import(document, document.Bounds); // Size the document to content document.SizeToContent(); return(((NCustomShapeCreatedListener)mapImporter.ShapeCreatedListener).Cities); }
private static void InitDocument(NDrawingDocument document, Type type) { // set up visual formatting document.BackgroundStyle.FrameStyle.Visible = false; document.ActiveLayer.RemoveAllChildren(); document.BeginInit(); NClassImporter importer = new NClassImporter(document); importer.ImportInActiveLayer = true; importer.Import(type); document.EndInit(); document.SizeToContent(); }
private void InitDocument(NDrawingDocument document) { // Remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // Adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; // Set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(251, 203, 156), Color.FromArgb(247, 150, 56)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); NStyleSheet sheet = new NStyleSheet("edges"); sheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); sheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.StyleSheets.AddChild(sheet); // Create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.LayoutScheme = TreeLayoutScheme.None; tree.Levels = 5; tree.BranchNodes = 2; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.ConnectorType = ConnectorType.Line; tree.VerticesShape = BasicShapes.Circle; tree.VerticesSize = new NSizeF(40, 40); tree.EdgesStyleSheetName = "edges"; tree.Create(document); // Create the layout NSingleCycleLayout layout = new NSingleCycleLayout(); // Get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); }
private void InitDocument() { NDrawingDocument document = NDrawingView1.Document; // remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(192, 194, 194), Color.FromArgb(129, 133, 133)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); // create a stylesheet for the edges NStyleSheet sheet = new NStyleSheet("edges"); sheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); sheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.StyleSheets.AddChild(sheet); // generate a simple tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.VerticesSize = new NSizeF(80, 80); tree.EdgesStyleSheetName = "edges"; tree.Create(document); // create a show/hide decorator for all shapes that have children NNodeList shapes = document.ActiveLayer.Descendants(NFilters.Shape2D, -1); int i, count = shapes.Count; for (i = 0; i < count; i++) { NShape shape = (NShape)shapes[i]; if (shape.GetOutgoingShapes().Count == 0) { continue; } shape.CreateShapeElements(ShapeElementsMask.Decorators); NShowHideSubtreeDecorator decorator = new NShowHideSubtreeDecorator(); decorator.Name = "ShowHideSubtree"; shape.Decorators.AddChild(new NShowHideSubtreeDecorator()); } // size the document to the content document.SizeToContent(); }
private void InitDocument(NDrawingDocument document) { // Set up visual formatting document.BackgroundStyle.FrameStyle.Visible = false; document.Style.TextStyle.FontStyle = new NFontStyle(document.Style.TextStyle.FontStyle.Name, 14); // Create the stylesheets int i = 0; int count = GradientSchemes.Length; for (i = 0; i < count; i++) { AdvancedGradientScheme scheme = GradientSchemes[i]; NStyleSheet styleSheet = new NStyleSheet(scheme.ToString()); NAdvancedGradientFillStyle fill = new NAdvancedGradientFillStyle(scheme, 4); if (scheme.Equals(AdvancedGradientScheme.Green)) { // Make the green color dark ((NAdvancedGradientPoint)fill.Points[0]).Color = Color.FromArgb(0, 128, 0); } NStyle.SetFillStyle(styleSheet, fill); document.StyleSheets.AddChild(styleSheet); NAdvancedGradientFillStyle highlightedFill = (NAdvancedGradientFillStyle)fill.Clone(); ((NAdvancedGradientPoint)highlightedFill.Points[0]).Color = ControlPaint.LightLight(((NAdvancedGradientPoint)fill.Points[0]).Color); NStyleSheet highlightedStyleSheet = new NStyleSheet(styleSheet.Name + HighlightedSuffix); NStyle.SetFillStyle(highlightedStyleSheet, highlightedFill); document.StyleSheets.AddChild(highlightedStyleSheet); } // Create the board and info shapes NClickomaniaGame game = new NClickomaniaGame(); CreateBoardShape(document, game); CreateInfoShape(document, game); game.BoardShape.Location = new NPointF(game.InfoShape.Bounds.Right + game.InfoShape.Width / 2, game.BoardShape.Location.Y); // Resize the document to fit all shapes document.SizeToContent(); game.InfoShape.Location = new NPointF(game.InfoShape.Location.X, game.BoardShape.Location.Y); document.Tag = game; }
private void InitDocument(NDrawingDocument document) { // Remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // Adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; // Set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(192, 194, 194), Color.FromArgb(129, 133, 133)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); NStyleSheet styleSheet = new NStyleSheet("orange"); styleSheet.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(251, 203, 156), Color.FromArgb(247, 150, 56)); styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.StyleSheets.AddChild(styleSheet); NStyleSheet sheet = new NStyleSheet("edges"); sheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); sheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.StyleSheets.AddChild(sheet); // Adjust the text properties document.Style.TextStyle.FontStyle = new NFontStyle("arial", 13f); // Create the predefined org chart DiagramRenderer renderer = new DiagramRenderer(); renderer.CreatePredefinedOrgChart(document); // Apply the layout renderer.ApplyLayout(document, null); // Resize document to fit all shapes document.SizeToContent(); }
private void DoLayout() { NDrawingDocument document = NDrawingView1.Document; NLayoutContext context = new NLayoutContext(); context.GraphAdapter = new NShapeGraphAdapter(true); context.BodyAdapter = new NShapeBodyAdapter(document); context.BodyContainerAdapter = new NDrawingBodyContainerAdapter(document); NLayeredGraphLayout layout = new NLayeredGraphLayout(); layout.Direction = LayoutDirection.LeftToRight; layout.EdgeRouting = LayeredLayoutEdgeRouting.Polyline; layout.PlugSpacing.Mode = PlugSpacingMode.None; NNodeList shapesToLayout = document.ActiveLayer.Children(NFilters.Shape2D); layout.Layout(shapesToLayout, context); // size to visible shapes document.SizeToContent(document.AutoBoundsMinSize, document.AutoBoundsPadding, NFilters.Visible); }
private void InitDocument(NDrawingDocument document) { // Remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // Adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; // Set up visual formatting document.Style.FillStyle = new NColorFillStyle(Color.Linen); document.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); // Adjust the text properties document.Style.TextStyle.FontStyle = new NFontStyle("arial", 15f); // Create the initial diagram CreatePredefinedGraph(document); // Create the layout NSpringLayout layout = new NSpringLayout(); // Configure the optional forces layout.BounceBackForce.Padding = 100f; layout.GravityForce.AttractionCoefficient = 0.2f; // Get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); }
protected void InitDocument() { NDrawingDocument document = NDrawingView1.Document; // set drawing preferences document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; document.GraphicsSettings.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; document.Style.FillStyle = new NColorFillStyle(Color.Linen); document.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial Narrow", 8)); document.BackgroundStyle.FrameStyle.Visible = false; // determine the shapes size and layout options NBasicShapesFactory factory = new NBasicShapesFactory(document); int maxOrdinal = 0; switch (shapeSizeDropDownList.SelectedValue) { case "Small": factory.DefaultSize = new NSizeF(40, 30); maxOrdinal = 7; break; case "Medium": factory.DefaultSize = new NSizeF(80, 60); maxOrdinal = 4; break; case "Large": factory.DefaultSize = new NSizeF(200, 150); maxOrdinal = 1; break; default: throw new NotImplementedException(shapeSizeDropDownList.SelectedValue); } // create the basic shapes in the active layer int count = factory.ShapesCount; NShape shape = null; for (int i = 0; i < count; i++) { // create a basic shape shape = factory.CreateShape(i); shape.Text = shape.Name; // add it to the active layer document.ActiveLayer.AddChild(shape); } // Add some content to the table shape NTableShape table = (NTableShape)shape; table.InitTable(2, 2); table.BeginUpdate(); table.CellMargins = new Nevron.Diagram.NMargins(8); table[0, 0].Text = "Cell 1"; table[1, 0].Text = "Cell 2"; table[0, 1].Text = "Cell 3"; table[1, 1].Text = "Cell 4"; table.PortDistributionMode = TablePortDistributionMode.CellBased; table.EndUpdate(); // layout the shapes in the active layer using a table layout NTableLayout layout = new NTableLayout(); layout.Direction = LayoutDirection.LeftToRight; layout.ConstrainMode = CellConstrainMode.Ordinal; layout.MaxOrdinal = maxOrdinal; layout.VerticalSpacing = 20; layout.HorizontalSpacing = 20; layout.HorizontalContentPlacement = ContentPlacement.Center; layout.VerticalContentPlacement = ContentPlacement.Center; NLayoutContext layoutContext = new NLayoutContext(); layoutContext.GraphAdapter = new NShapeGraphAdapter(); layoutContext.BodyAdapter = new NShapeBodyAdapter(document); layoutContext.BodyContainerAdapter = new NDrawingBodyContainerAdapter(document); layout.Layout(document.ActiveLayer.Children(null), layoutContext); // resize document to fit all shapes document.SizeToContent(); }
protected void Page_Load(object sender, System.EventArgs e) { // begin view init base.DefaultGridOrigin = new NPointF(30, 30); base.DefaultGridCellSize = new NSizeF(100, 50); base.DefaultGridSpacing = new NSizeF(50, 40); NDrawingDocument document = NThinDiagramControl1.Document; if (!NThinDiagramControl1.Initialized) { NThinDiagramControl1.View.Layout = CanvasLayout.Fit; // add the client mouse event tool NThinDiagramControl1.Controller.Tools.Add(new NPostbackTool()); document.BeginInit(); document.BackgroundStyle.FrameStyle.Visible = false; document.AutoBoundsPadding = new Nevron.Diagram.NMargins(10f, 10f, 10f, 10f); document.Style.FillStyle = new NColorFillStyle(Color.White); NBasicShapesFactory factory = new NBasicShapesFactory(document); NShape outerCircle = factory.CreateShape(BasicShapes.Circle); outerCircle.Bounds = new NRectangleF(0f, 0f, 200f, 200f); document.ActiveLayer.AddChild(outerCircle); NShape rect = factory.CreateShape(BasicShapes.Rectangle); rect.Bounds = new NRectangleF(42f, 42f, 50f, 50f); rect.Style.FillStyle = new NColorFillStyle(Color.LightBlue); rect.Style.InteractivityStyle = CreateInteractivityStyle("Rectangle"); rect.Tag = true; document.ActiveLayer.AddChild(rect); NShape triangle = factory.CreateShape(BasicShapes.Triangle); triangle.Bounds = new NRectangleF(121f, 57f, 60f, 55f); triangle.Style.FillStyle = new NColorFillStyle(Color.LightBlue); triangle.Style.InteractivityStyle = CreateInteractivityStyle("Triangle"); triangle.Tag = true; document.ActiveLayer.AddChild(triangle); NShape pentagon = factory.CreateShape(BasicShapes.Pentagon); pentagon.Bounds = new NRectangleF(60f, 120f, 54f, 50f); pentagon.Style.FillStyle = new NColorFillStyle(Color.LightBlue); pentagon.Style.InteractivityStyle = CreateInteractivityStyle("Pentagon"); pentagon.Tag = true; document.ActiveLayer.AddChild(pentagon); document.SizeToContent(); document.EndInit(); } // Create a few simple shapes with attached client mouse event interactivity NThinDiagramControl1.Postback += new NPostbackEventHandler(NThinDiagramControl1_Postback); NThinDiagramControl1.Controller.Tools.Clear(); NTooltipTool tooltipTool = new NTooltipTool(); NThinDiagramControl1.Controller.Tools.Add(tooltipTool); NPostbackTool postbackTool = new NPostbackTool(); // postbackTool.PostbackOnlyOnInteractiveItems = PostbackOnlyOnInteractiveItemsCheckBox.Checked; NThinDiagramControl1.Controller.Tools.Add(postbackTool); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { CaptureMouseEventDropDownList.Items.Add("Mouse Down"); CaptureMouseEventDropDownList.Items.Add("Mouse Up"); CaptureMouseEventDropDownList.Items.Add("Click"); CaptureMouseEventDropDownList.Items.Add("Double Click"); CaptureMouseEventDropDownList.Items.Add("Mouse Enter"); CaptureMouseEventDropDownList.Items.Add("Mouse Leave"); CaptureMouseEventDropDownList.SelectedIndex = 0; } // begin view init base.DefaultGridOrigin = new NPointF(30, 30); base.DefaultGridCellSize = new NSizeF(100, 50); base.DefaultGridSpacing = new NSizeF(50, 40); NDrawingDocument document = NThinDiagramControl1.Document; if (!NThinDiagramControl1.Initialized) { NThinDiagramControl1.View.Layout = CanvasLayout.Fit; // add the client mouse event tool NThinDiagramControl1.Controller.Tools.Add(new NClientMouseEventTool()); } // Create a few simple shapes with attached client mouse event interactivity document.Reset(); document.BeginInit(); document.BackgroundStyle.FrameStyle.Visible = false; document.AutoBoundsPadding = new Nevron.Diagram.NMargins(10f, 10f, 10f, 10f); document.Style.FillStyle = new NColorFillStyle(Color.White); NBasicShapesFactory factory = new NBasicShapesFactory(document); NShape outerCircle = factory.CreateShape(BasicShapes.Circle); outerCircle.Bounds = new NRectangleF(0f, 0f, 200f, 200f); document.ActiveLayer.AddChild(outerCircle); NShape rect = factory.CreateShape(BasicShapes.Rectangle); rect.Bounds = new NRectangleF(42f, 42f, 50f, 50f); rect.Style.FillStyle = new NColorFillStyle(Color.Orange); rect.Style.InteractivityStyle = CreateInteractivityStyle("Rectangle"); document.ActiveLayer.AddChild(rect); NShape triangle = factory.CreateShape(BasicShapes.Triangle); triangle.Bounds = new NRectangleF(121f, 57f, 60f, 55f); triangle.Style.FillStyle = new NColorFillStyle(Color.LightGray); triangle.Style.InteractivityStyle = CreateInteractivityStyle("Triangle"); document.ActiveLayer.AddChild(triangle); NShape pentagon = factory.CreateShape(BasicShapes.Pentagon); pentagon.Bounds = new NRectangleF(60f, 120f, 54f, 50f); pentagon.Style.FillStyle = new NColorFillStyle(Color.WhiteSmoke); pentagon.Style.InteractivityStyle = CreateInteractivityStyle("Pentagon"); document.ActiveLayer.AddChild(pentagon); document.SizeToContent(); document.EndInit(); }
protected void InitDocument(NDrawingDocument document, NShapesFactory factory) { NDrawingView1.Document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; NDrawingView1.Document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; NDrawingView1.Document.GraphicsSettings.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; // set up visual formatting NDrawingView1.Document.Style.FillStyle = new NColorFillStyle(Color.Linen); NDrawingView1.Document.BackgroundStyle.FrameStyle.Visible = false; NDrawingView1.Document.BackgroundStyle.FillStyle = new NColorFillStyle(Color.FromArgb(0xca, 0xca, 0xca)); int maxOrdinal = 0; document.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial Narrow", 8)); switch (shapeSizeDropDownList.SelectedValue) { case "Small": factory.DefaultSize = new NSizeF(40, 30); maxOrdinal = 7; break; case "Medium": factory.DefaultSize = new NSizeF(80, 60); maxOrdinal = 4; break; case "Large": factory.DefaultSize = new NSizeF(200, 150); maxOrdinal = 1; break; default: throw new NotImplementedException(shapeSizeDropDownList.SelectedValue); } int count = factory.ShapesCount; for (int i = 0; i < count; i++) { // create a basic shape NShape shape = factory.CreateShape(i); shape.Style.InteractivityStyle = new NInteractivityStyle(shape.Name); // add it to the active layer document.ActiveLayer.AddChild(shape); } // layout the shapes in the active layer using a table layout NTableLayout layout = new NTableLayout(); // setup the table layout layout.Direction = LayoutDirection.LeftToRight; layout.ConstrainMode = CellConstrainMode.Ordinal; layout.MaxOrdinal = maxOrdinal; layout.VerticalSpacing = 20; layout.HorizontalSpacing = 20; layout.HorizontalContentPlacement = ContentPlacement.Center; layout.VerticalContentPlacement = ContentPlacement.Center; // create a layout context NLayoutContext layoutContext = new NLayoutContext(); layoutContext.GraphAdapter = new NShapeGraphAdapter(); layoutContext.BodyAdapter = new NShapeBodyAdapter(document); layoutContext.BodyContainerAdapter = new NDrawingBodyContainerAdapter(document); // layout the shapes layout.Layout(document.ActiveLayer.Children(null), layoutContext); // resize document to fit all shapes document.SizeToContent(); }
protected void InitDocument() { NDrawingDocument document = NDrawingView1.Document; // Import the Visio stencil NLibraryDocument libDocument = new NLibraryDocument(); NVisioImporter importer = new NVisioImporter(libDocument); importer.Import(Server.MapPath(@"~\Examples\Import\Computers.vsx")); // Set drawing preferences document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; document.GraphicsSettings.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; document.BackgroundStyle.FrameStyle.Visible = false; // Determine the shape size int maxOrdinal = 0; int scale = 1; switch (shapeSizeDropDownList.SelectedValue) { case "Small": scale = 1; maxOrdinal = 5; break; case "Medium": scale = 2; maxOrdinal = 3; break; case "Large": scale = 4; maxOrdinal = 1; break; default: throw new NotImplementedException(shapeSizeDropDownList.SelectedValue); } // Determine the shapes size and layout options NNodeList masters = libDocument.Children(NFilters.TypeNMaster); for (int i = 0, count = masters.Count; i < count; i++) { NMaster master = (NMaster)masters[i]; NNodeList shapes = master.CreateInstance(document, new NPointF(0, 0)); NShape shape = (NShape)shapes[0]; shape.Width *= scale; shape.Height *= scale; NStyle.SetInteractivityStyle(shape, new NInteractivityStyle(master.Name)); } // Layout the shapes in the active layer using a table layout NTableLayout layout = new NTableLayout(); layout.Direction = LayoutDirection.LeftToRight; layout.ConstrainMode = CellConstrainMode.Ordinal; layout.MaxOrdinal = maxOrdinal; layout.VerticalSpacing = 20; layout.HorizontalSpacing = 20; layout.HorizontalContentPlacement = ContentPlacement.Center; layout.VerticalContentPlacement = ContentPlacement.Center; layout.Layout(document.ActiveLayer.Children(null), new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); }
private void CreateScene(NDrawingDocument document) { document.BackgroundStyle.FrameStyle.Visible = false; // change default document styles document.Style.TextStyle.TextFormat = TextFormat.XML; document.Style.StartArrowheadStyle.Shape = ArrowheadShape.None; document.Style.EndArrowheadStyle.Shape = ArrowheadShape.None; document.Style.FillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant1, new NArgbColor(155, 184, 209), new NArgbColor(83, 138, 179)); // the fill style for the cells NStyleSheet transparent = new NStyleSheet("transparent"); NStyle.SetFillStyle(transparent, new NColorFillStyle(KnownArgbColorValue.Transparent)); document.StyleSheets.AddChild(transparent); NNodeList shapes = new NNodeList(); NShape shape1, shape2, winner = null; int i, depth = 0; int count = MATCHES.Length; for (i = 0; i < count; i++) { winner = CreateShape(MATCHES[i]); shapes.Add(winner); if (i >= 8) { if (i < 12) { // The quarter finals depth = 0; shape1 = (NShape)shapes[(i - 8) * 2]; shape2 = (NShape)shapes[(i - 8) * 2 + 1]; } else if (i < 14) { // The semi finals depth = 2; shape1 = (NShape)shapes[8 + (i - 12) * 2]; shape2 = (NShape)shapes[8 + (i - 12) * 2 + 1]; } else { // The final depth = 4; shape1 = (NShape)shapes[12]; shape2 = (NShape)shapes[13]; } SetAnimationsStyle(shape1, depth); SetAnimationsStyle(shape2, depth); ConnectShapes(shape1, shape2, winner, depth + 1); } } SetAnimationsStyle(winner, depth + 2); NLayeredGraphLayout layout = new NLayeredGraphLayout(); layout.Direction = LayoutDirection.LeftToRight; layout.Layout(shapes, new NDrawingLayoutContext(document)); // resize document to fit all shapes document.SizeToContent(); }