protected override void LoadExample() { // create the compact depth layout m_Layout = new NCompactDepthTreeLayout(); // instruct the layout to perform HV layout of the edges m_Layout.OrthogonalEdgeRouting = true; // show the layout properties in the property grid propertyGrid1.SelectedObject = m_Layout; view.BeginInit(); view.Grid.Visible = false; view.GlobalVisibility.ShowPorts = false; view.GlobalVisibility.ShowArrowheads = false; view.ViewLayout = ViewLayout.Fit; // init document document.BeginInit(); 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)); InitDocument(); document.EndInit(); // init form controls InitFormControls(); // end view init view.EndInit(); }
protected void PerformLayout(Hashtable args) { // Create the layout NCompactDepthTreeLayout layout = new NCompactDepthTreeLayout(); // 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(); }
public void ApplyLayout(NDrawingDocument document, Dictionary <string, string> settings) { // Create the layout NCompactDepthTreeLayout layout = new NCompactDepthTreeLayout(); // Configure the layout if (settings != null) { NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); 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)); }