Diagram for .NET / User's Guide / WinForm Components / Library Browser

Library Browser

The library browser is represented by an instance the NLibraryBrowser class, which is, in essence, an extended Nevron UI panel bar. The content of the library browser is organized in groups. Each group is represented by an instance of the NLibraryGroup class. The library browser can be controlled by the manager if the LibraryBrowser property of the NDiagramCommandBarsManager is set to it.

C#
Copy Code
// create a new manager and library browser
NDiagramCommandBarsManager manager = new NDiagramCommandBarsManager();
NLibraryBrowser browser = new NLibraryBrowser();

...

// attach the library browser to the manager
manager.LibraryBrowser = browser;
Visual Basic
Copy Code
' create a new manager and library browser
Dim manager As New NDiagramCommandBarsManager
Dim browser As New NLibraryBrowser

...

' attach the library browser to the manager
manager.LibraryBrowser = browser
 Library Browser Functionality

The functionality of the library browser is primarily oriented towards helping you maintain the displayed library groups. The exposed methods can generally be divided as follows:

  • New - you can create a new empty group with the help of the NewEmptyLibraryGroup method. The library browser can also be used to create the predefined Flowcharting Shapes and Connector Shapes library groups (via the NewFlowchartingShapesLibraryGroup and NewConnectorShapesLibraryGroup methods):
    C#
    Copy Code
    // create a new empty group with custom title
    browser.NewEmptyLibraryGroup("My Group");
    
    // create the predefined flowcharting shapes with size 20, 20 in millimeters
    browser.NewFlowchartingShapesLibraryGroup(NGraphicsUnit.Millimeter, new NSizeF(20, 20));
    
    // create the predefined connector shapes with size 20, 20 in millimeters
    browser.NewConnectorShapesLibraryGroup(NGraphicsUnit.Millimeter, new NSizeF(20, 20));
    
    Visual Basic
    Copy Code
    ' attach the library browser to the manager
    manager.LibraryBrowser = browser
    
    ' create a new empty group with custom title
    browser.NewEmptyLibraryGroup("My Group")
    
    ' create the predefined flowcharting shapes with size 20, 20 in millimeters
    browser.NewFlowchartingShapesLibraryGroup(NGraphicsUnit.Millimeter, New NSizeF(20, 20))
    
    ' create the predefined connector shapes with size 20, 20 in millimeters
    browser.NewConnectorShapesLibraryGroup(NGraphicsUnit.Millimeter, New NSizeF(20, 20))
    
  • Open - you can open an already existing library document in a group with the OpenLibraryGroup methods:
    C#
    Copy Code
    // open a new library group by prompting the user
    browser.OpenLibraryGroup();
    
    // open a new library group from the specified library document file
    browser.OpenLibraryGroup("c:\\temp\\mylibrary.nlb");
    
    // open a new library group from already existing library
    browser.OpenLibraryGroup(library);
    
    Visual Basic
    Copy Code
    ' open a new library group by prompting the user
    browser.OpenLibraryGroup()
    
    ' open a new library group from the specified library document file
    browser.OpenLibraryGroup("c:\\temp\\mylibrary.nlb")
    
    ' open a new library group from already existing library
    browser.OpenLibraryGroup(library)
    
  • Close - you can always close an already opened group by calling the CloseLibraryGroup method
You can view libraries in several ways. The way in which you view all libraries displayed by the browser is controlled by the ViewStyle property.
 Library Groups
Library groups are extended Nevron UI panel bar bands, which host an instance of a library view and the library document they represent. The library view can be obtained from the View property, while the library itself is exposed by the Document property.
 Related Examples
Windows Forms: Visual Interface Components - Library Browser 
See Also