Exemple #1
0
        protected override void LoadExample()
        {
            // begin view init
            view.BeginInit();

            // configure the view
            view.Grid.Visible               = false;
            view.Selection.Mode             = DiagramSelectionMode.Single;
            view.GlobalVisibility.ShowPorts = false;
            view.HorizontalRuler.Visible    = false;
            view.VerticalRuler.Visible      = false;

            // create some shape factories
            m_FilesAndFoldersFactory             = new NFilesAndFoldersFactory();
            m_FilesAndFoldersFactory.DefaultSize = VertexSize;

            m_BusinessProcessShapesFactory             = new NBusinessProcessShapesFactory();
            m_BusinessProcessShapesFactory.DefaultSize = SymbolSize;

            // import the data
            ImportData();

            // end view init
            view.EndInit();
        }
        private void InitDocument()
        {
            document.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial Narrow", 8));

            NFilesAndFoldersFactory factory = new NFilesAndFoldersFactory(document);

            factory.DefaultSize = new NSizeF(80, 60);

            int count = factory.ShapesCount;

            for (int i = 0; i < count; i++)
            {
                // create a basic shape
                NShape shape = factory.CreateShape(i);
                shape.Style.InteractivityStyle = new NInteractivityStyle(shape.Name);

                // add it to the active layer
                document.ActiveLayer.AddChild(shape);
            }

            // layout the shapes in the active layer using a table layout
            NTableLayout layout = new NTableLayout();

            // setup the table layout
            layout.Direction     = LayoutDirection.LeftToRight;
            layout.ConstrainMode = CellConstrainMode.Ordinal;
            layout.MaxOrdinal    = 5;
            layout.HorizontalContentPlacement = ContentPlacement.Center;
            layout.VerticalContentPlacement   = ContentPlacement.Center;
            layout.VerticalSpacing            = 20;
            layout.HorizontalSpacing          = 20;

            // get the shapes to layout
            NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D);

            // create a layout context
            NLayoutContext layoutContext = new NLayoutContext();

            layoutContext.GraphAdapter         = new NShapeGraphAdapter();
            layoutContext.BodyAdapter          = new NShapeBodyAdapter(document);
            layoutContext.BodyContainerAdapter = new NDrawingBodyContainerAdapter(document);

            // layout the shapes
            layout.Layout(shapes, layoutContext);

            // resize document to fit all shapes
            document.SizeToContent();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // create some shape factories
            m_FilesAndFoldersFactory             = new NFilesAndFoldersFactory();
            m_FilesAndFoldersFactory.DefaultSize = VertexSize;

            m_BusinessProcessShapesFactory             = new NBusinessProcessShapesFactory();
            m_BusinessProcessShapesFactory.DefaultSize = SymbolSize;

            // import the data
            NDrawingView1.Document.BeginInit();
            ImportData();
            NDrawingView1.Document.EndInit();

            // size the view to its content
            NDrawingView1.SizeToContent();
        }