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(); }
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)); document.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, String.Empty, NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, String.Empty, NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); // Create a tree DiagramRenderer renderer = new DiagramRenderer(); renderer.CreateTree(document, 4, 3); // Apply the layout renderer.ApplyLayout(document, null); // Resize document to fit all shapes document.SizeToContent(); }