In This Topic
About Drawings
Drawings are represented by the NDrawing class, an instance of which can be obtained from the Content property of the NDrawingDocument class. Drawings are the root elements of a drawing hierarchy.
Each drawing is composed from a set of pages that are contained in an NPageCollection accessible from the Pages property of the drawing. Of all pages inside the drawing only one can be active at a time. The active page is controlled by the ActivePageIndex property or the ActivePage property. By default each drawing is created with a single page that is at the same time the active page of the drawing. The following code example creates a second drawing page and makes it the active one:
Changing the Active Page |
Copy Code
|
NDrawing drawing = drawingView.Content;
NPage secondPage = new NPage();
drawing.Pages.Add(secondPage);
drawing.ActivePage = secondPage;
|
Media Visibility
The NScreenVisibility and NPrintVisibility elements (derived from NMediaVisibility) are accessible from the ScreenVisibility and PrintVisibility properties respectively. They control the global visibility of certain diagram elements when the drawing is displayed on screen and when printed (or exported to other formats).
By default the grid, guidelines, ports and page breaks are not displayed when the drawing is printed and that is why the respective properties of the media visibility accessible by the PrintVisibility property are set to false.
It is also often required to hide the grid, guidelines, ports, rulers and page breaks of content displayed on screen. You do that by setting the respective properties of the ScreenVisibility to false. For example the following code hides the grid, rulers, guidelines and ports for all pages in the specified drawing:
Hide the Grid, Guidelines, Rulers and Ports |
Copy Code
|
NScreenVisibility visibility = drawingView.Content.ScreenVisibility;
visibility.ShowGrid = false;
visibility.ShowGuidelines = false;
visibility.ShowRulers = false;
visibility.ShowPorts = false;
|
Settings
The NDrawingSettings element accessible from Settings property controls global settings for the drawing. These settings can be generally classified in the following categories:
- Hit Test - properties controlling the widening of the different geometry figures that can be hit tested for selection and other purposes.
- Copy Paste - properties controlling the offset applied to copy pasted elements.
- Edit and Layout - properties controlling different parameters of the edit and layout commands (such as step of rotation, step of nudge etc.)
- Trackers - properties controlling the appearance and behavior of the page item editors and the handles.
Diagram Extensions
Diagram extensions are elements that can be added to a drawing or a page and define what types of diagram a drawing or a page contains. When some diagram extensions (e.g. the NFamilyTreeExtension) are set to a drawing or a page, contextual ribbon type with commands specific for that diagram type are shown in the NOV Diagram ribbon.
The following piece of code demonstrates how to add the NFamilyTreeExtension to a drawing:
Adding diagram extensions |
Copy Code
|
drawingView.Drawing.Extensions = new NDiagramExtensionCollection();
drawingView.Drawing.Extensions.Add(new NFamilyTreeExtension());
|
If the Extensions property of a page is set, it overrides the diagram extensions set to the Extensions property of the drawing. This makes it possible to have different types of diagram in each page of a drawing.
See Also