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; }
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); }