示例#1
0
        private void btnLayoutGroupA_Click(object sender, System.EventArgs e)
        {
            NLayeredTreeLayout layout = new NLayeredTreeLayout();

            layout.PlugSpacing.Mode = PlugSpacingMode.None;
            layout.Layout(Group1.Shapes.Children(null), new NDrawingLayoutContext(document, Group1));
            Group1.UpdateModelBounds();
            LayoutGroups();
        }
示例#2
0
        private void LayoutGroups()
        {
            NLayeredTreeLayout layout = new NLayeredTreeLayout();

            layout.PlugSpacing.Mode = PlugSpacingMode.None;

            NNodeList shapes = new NNodeList();

            shapes.Add(document.ActiveLayer.GetChildByName("treeRoot"));
            shapes.Add(document.ActiveLayer.GetChildByName("leftEdge"));
            shapes.Add(document.ActiveLayer.GetChildByName("rightEdge"));
            shapes.Add(Group1);
            shapes.Add(Group2);

            layout.Layout(shapes, new NDrawingLayoutContext(document, shapes));
            Group1.UpdateModelBounds();
            Group2.UpdateModelBounds();
        }
示例#3
0
        private void InitDocument()
        {
            // create the groups
            Group1 = CreateGroup("A");
            Group2 = CreateGroup("B");

            // apply default styles
            Group1.Style.FillStyle = new NColorFillStyle(Color.FromArgb(50, 204, 0, 0));
            Group2.Style.FillStyle = new NColorFillStyle(Color.FromArgb(50, 0, 204, 0));

            // create the root shape
            NShape root = new NRectangleShape(0, 0, 40, 40);

            root.Name = "treeRoot";
            root.Text = "0";
            document.ActiveLayer.AddChild(root);
            CreateShapePorts(root);

            NRoutableConnector connector = new NRoutableConnector(RoutableConnectorType.DynamicPolyline);

            document.ActiveLayer.AddChild(connector);
            connector.Name      = "leftEdge";
            connector.FromShape = root;
            connector.ToShape   = Group1;

            connector      = new NRoutableConnector(RoutableConnectorType.DynamicPolyline);
            connector.Name = "rightEdge";
            document.ActiveLayer.AddChild(connector);
            connector.FromShape = root;
            connector.ToShape   = Group2;

            // do layout
            LayoutGroups();
            Group1.UpdateModelBounds();
            Group2.UpdateModelBounds();
        }