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(); }
protected override void LoadExample() { // init form fields m_Layout = new NSingleCycleLayout(); propertyGrid1.SelectedObject = m_Layout; view.BeginInit(); view.Grid.Visible = false; view.GlobalVisibility.ShowPorts = false; view.ViewLayout = ViewLayout.Fit; // init document document.BeginInit(); 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)); InitDocument(); document.EndInit(); // init form controls InitFormControls(); // end view init view.EndInit(); }
private void InitFormControls() { PauseEventsHandling(); // Create the layouts NLayeredGraphLayout layered = new NLayeredGraphLayout(); layered.LayerSpacing = 100; NSingleCycleLayout singleCycle = new NSingleCycleLayout(); singleCycle.RingRadius = 1000; NSymmetricalLayout symmetrical = new NSymmetricalLayout(); cbLayout.Items.AddRange(new NLayout[] { layered, singleCycle, symmetrical }); cbLayout.SelectedIndex = 0; ResumeEventsHandling(); }
private void PerformLayout(Hashtable args) { // Create the layout NSingleCycleLayout layout = new NSingleCycleLayout(); // Configure the layout NLayoutsHelper.ConfigureLayout(layout, args); // Get the shapes to layout NNodeList shapes = NDrawingView1.Document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(NDrawingView1.Document)); // Resize document to fit all shapes NDrawingView1.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(); }