Пример #1
0
        private void InitFormControls()
        {
            libDocument = new NLibraryDocument();

            libView = new NLibraryView();
            pLibrary.Controls.Add(libView);
            libView.Dock     = DockStyle.Fill;
            libView.Document = libDocument;

            DirectoryInfo directory = new DirectoryInfo(Path.Combine(Application.StartupPath, @"..\..\Resources\Data"));

            dlgOpen.InitialDirectory = directory.FullName;
        }
Пример #2
0
        protected override void LoadExample()
        {
            // Init view and document
            view.BeginInit();
            view.HorizontalRuler.Visible = false;
            view.VerticalRuler.Visible   = false;
            view.EndInit();

            // Init controls
            NLibraryView libView = CreateLibrary();

            libView.SetBounds(0, 0, this.Width, this.commonControlsPanel.Top);
            libView.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            this.Controls.Add(libView);
        }
Пример #3
0
        protected override void LoadExample()
        {
            // Init view and document
            view.BeginInit();
            view.VerticalRuler.Visible        = false;
            view.HorizontalRuler.Visible      = false;
            view.Grid.Visible                 = false;
            view.GlobalVisibility.ShowPorts   = false;
            view.GlobalVisibility.ShowShadows = false;
            view.ViewLayout = ViewLayout.Fit;

            document.AutoBoundsMode = AutoBoundsMode.AutoSizeToContent;

            // Create and add the UML style sheets to the drawing document
            NUmlShape.AddUmlStyleSheets(document);

            view.EndInit();

            // Init controls
            Panel panel = new Panel();

            panel.SetBounds(0, 0, this.Width, this.commonControlsPanel.Top);
            panel.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            this.Controls.Add(panel);

            NLibraryView libView = CreateLibrary();

            libView.Dock = DockStyle.Fill;
            panel.Controls.Add(libView);

            Panel buttonPanel = new Panel();

            buttonPanel.Height  = 45;
            buttonPanel.Padding = new Padding(10);
            buttonPanel.Dock    = DockStyle.Bottom;
            panel.Controls.Add(buttonPanel);

            NButton importButton = new NButton();

            importButton.Text = "Import Class Hierarchy";
            importButton.Dock = DockStyle.Fill;
            buttonPanel.Controls.Add(importButton);
            importButton.Click += OnImportButtonClick;
        }
Пример #4
0
        private NLibraryView CreateLibrary()
        {
            NLibraryDocument libDocument = new NLibraryDocument();

            libDocument.BackgroundStyle           = new NBackgroundStyle();
            libDocument.BackgroundStyle.FillStyle = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.Vertical, GradientVariant.Variant1,
                                                                           Color.RoyalBlue, Color.LightSkyBlue);

            NLibraryView libView = new NLibraryView();

            libView.AllowDrop      = false;
            libView.Document       = libDocument;
            libView.ScrollBars     = ScrollBars.None;
            libView.Selection.Mode = DiagramSelectionMode.Single;
            libView.Document       = libDocument;

            NUmlShape shape  = new NUmlShape(0, 0, 100, 25, true);
            NMaster   master = new NMaster(shape, NGraphicsUnit.Pixel, "Class", "Drag me on the drawing");

            libDocument.AddChild(master);
            shape.Name = "Class";

            shape          = new NUmlShape(0, 0, 100, 25, true);
            shape.Abstract = true;
            master         = new NMaster(shape, NGraphicsUnit.Pixel, "Abstract Class", "Drag me on the drawing");
            libDocument.AddChild(master);
            shape.Name = "AbstractClass";

            // Connectors
            master = CreateGeneralizationMaster();
            libDocument.AddChild(master);

            master = CreateAssociationMaster();
            libDocument.AddChild(master);

            master = CreateAggregarionMaster();
            libDocument.AddChild(master);

            master = CreateCompositionMaster();
            libDocument.AddChild(master);

            return(libView);
        }
Пример #5
0
        private NLibraryView CreateLibrary()
        {
            NLibraryView libView = new NLibraryView();

            libView.ScrollBars     = ScrollBars.Vertical;
            libView.Selection.Mode = DiagramSelectionMode.Single;

            NLibraryDocument libDoc = new NLibraryDocument();

            libView.Document                 = libDoc;
            libDoc.BackgroundStyle           = new NBackgroundStyle();
            libDoc.BackgroundStyle.FillStyle = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.Vertical, GradientVariant.Variant1,
                                                                      Color.RoyalBlue, Color.LightSkyBlue);

            // Horizontal Pipe
            NCompositeShape shape  = CreateHorizontalPipe();
            NMaster         master = new NMaster(shape, NGraphicsUnit.Pixel, "Horizontal Pipe", "Drag me on the drawing");

            libDoc.AddChild(master);

            // Vertical Pipe
            shape  = CreateVerticalPipe();
            master = new NMaster(shape, NGraphicsUnit.Pixel, "Vertical Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // Cross Pipe
            shape  = CreateCrossPipe();
            master = new NMaster(shape, NGraphicsUnit.Pixel, "Cross Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // North-West Pipe
            shape  = CreateElbowPipe("NW");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "North-West Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // North-East Pipe
            shape  = CreateElbowPipe("NE");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "North-East Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // South-West Pipe
            shape  = CreateElbowPipe("SW");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "South-West Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // South-East Pipe
            shape  = CreateElbowPipe("SE");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "South-East Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // North-East-West Pipe
            shape  = CreateTPipe("NEW");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "North-East-West Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // North-East-South Pipe
            shape  = CreateTPipe("NES");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "North-East-South Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // North-West-South Pipe
            shape  = CreateTPipe("NWS");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "North-West-South Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // South-East-West Pipe
            shape  = CreateTPipe("SEW");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "South-East-West Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // West-End Pipe
            shape  = CreateEndPipe("W");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "West-End Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // North-End Pipe
            shape  = CreateEndPipe("N");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "North-End Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // East-End Pipe
            shape  = CreateEndPipe("E");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "East-End Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            // South-End Pipe
            shape  = CreateEndPipe("S");
            master = new NMaster(shape, NGraphicsUnit.Pixel, "South-End Pipe", "Drag me on the drawing");
            libDoc.AddChild(master);

            return(libView);
        }