protected override void LoadExample() { // create a stylesheet for the CustomConnectors NStyleSheet styleSheet = new NStyleSheet("CustomConnectors"); styleSheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.Circle, "CustomConnectorStart", new NSizeL(6, 6), new NColorFillStyle(Color.FromArgb(247, 150, 56)), new NStrokeStyle(1, Color.FromArgb(68, 90, 108))); styleSheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.Arrow, "CustomConnectorStart", new NSizeL(6, 6), new NColorFillStyle(Color.FromArgb(247, 150, 56)), new NStrokeStyle(1, Color.FromArgb(68, 90, 108))); styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); document.StyleSheets.AddChild(styleSheet); // init form fields m_Layout = new NOrthogonalGraphLayout(); 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(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(); }
private void PerformLayout(Hashtable args) { // Create the layout NOrthogonalGraphLayout layout = new NOrthogonalGraphLayout(); // 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 NOrthogonalGraphLayout layout = new NOrthogonalGraphLayout(); // 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)); }