The following code demonstrates how to add documents to the document view:
C# |
Copy Code
|
---|---|
NDocumentManager manager = this.nDockManager1.DocumentManager; //create a uidocument instance NUIDocument doc = new NUIDocument(); doc.Text = "My Document"; doc.Client = new TextBox(); //add the document to the current document view (which is TabbedMdi by default) manager.AddDocument(doc); |
Visual Basic |
Copy Code
|
---|---|
Dim manager As NDocumentManager = Me.nDockManager1.DocumentManager 'create a uidocument instance NUIDocument doc = New NUIDocument() doc.Text = "My Document" doc.Client = New TextBox() 'add the document to the current document view (which is TabbedMdi by default) manager.AddDocument(doc) |
You have complete control over the adding process. The AddDocument method has 4 different overloads via which you may select the parent zone, DockStyle and index of insertion.
The following table describes events fired by the NDocumentManager instance:
Method | Description |
---|---|
Fired when the currently active document has changed. |
|
Fired whenever a document has been activated. Note that a document might be activated multiple times. |
|
Fired when a document has been closed and removed from the view. |
|
Fired when a document is about to be closed. Cancelable. |
|
Fired when a document has been inserted. |
|
Fired when a document is about to be inserted. Cancelable. |
|
Fired when the current document view style has changed. |
|
Fired when the current document drag operation just started. |
|
Fired when the current document drag operation ends. |
The NDocumentManager exposes lots of events among which are the DocumentActivated and ActiveDocumentChanged ones. The first event is fired whenever a document is activated while the second one is fired when the current active document changes.
The object which controls documents appearance as well as document view style, document strips, etc. is the NDocumentStyle, member of the NDocumentManager.
The following code demonstrates how to change the appearance of the document view:
C# |
Copy Code
|
---|---|
NDocumentStyle style = this.nDockManager1.DocumentStyle;
style.TabAlign = TabAlign.Bottom;
style.TabStyle = TabStyle.MultiDocument;
style.StripButtons = DocumentStripButtons.VS2003;
|
Visual Basic |
Copy Code
|
---|---|
Dim style As NDocumentStyle = Me.nDockManager1.DocumentStyle style.TabAlign = TabAlign.Bottom style.TabStyle = TabStyle.MultiDocument style.StripButtons = DocumentStripButtons.VS2003 |
The NDocumentManager comes with a built-in editor which allows you to visually activate, close, tile, etc. documents.
The following code demonstrates how to display the editor:
C# |
Copy Code
|
---|---|
this.nDockManager1.DocumentManager.ShowDocumentsEditor();
|
Visual Basic |
Copy Code
|
---|---|
Me.nDockManager1.DocumentManager.ShowDocumentsEditor()
|