protected override void LoadExample() { // attach the library browser to the command bars manager, // in order so that it can display context menus Form.CommandBarsManager.LibraryBrowser = libraryBrowser; // clear all bands (library groups) libraryBrowser.ClearBands(); // create a new library NLibraryDocument library = new NLibraryDocument(); library.Info.Title = "My first library"; NBasicShapesFactory factory = new NBasicShapesFactory(document); // add several masters in the library NShape shape = factory.CreateShape((int)BasicShapes.Pentagram); shape.Width = 130; shape.Height = 130; library.AddChild(new NMaster(shape, NGraphicsUnit.Pixel, "Star", "My star")); shape = factory.CreateShape((int)BasicShapes.Octagram); shape.Width = 130; shape.Height = 130; library.AddChild(new NMaster(shape, NGraphicsUnit.Pixel, "Octagon", "My octagon")); // create a new library group hosting the library libraryBrowser.OpenLibraryGroup(library); // start view init view.BeginInit(); document.Style.StartArrowheadStyle.Shape = ArrowheadShape.None; document.Style.EndArrowheadStyle.Shape = ArrowheadShape.None; view.AllowDrop = true; // init document document.BeginInit(); CreateCustomOpenFigureShape(); CreateCustomClosedFigureShape(); document.EndInit(); // init form controls InitFormControls(); // end view init view.EndInit(); }
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); }
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); }