The following image illustrates the diagram element collections class hierarchy:
The following image illustrates the diagram element collections class hierarchy:
The following table summarizes the most important collection types:
Collection class | Description |
---|---|
Related to drawing documents | |
NLayerCollection | An instance of this collection can be obtained from the Layers property of the NDrawingDocument class. It stores the layers of a drawing. |
NGuidelineCollection | An instance of this collection can be obtained from the Guidelines property of the NDrawingDocument class. It stores the drawing guidelines |
NStyleSheetCollection | An instance of this collection can be obtained from the StyleSheets property of the NDrawingDocument class. It stores the stylesheets of a drawing |
NArrowheadShapeStencil |
An instance of this collection can be obtained from the ArrowheadShapeStencil property of the NDrawingDocument class. It is used to hold the shapes of the arrowheads, which can be displayed at the start and end point of each open figure (see below). |
NPointShapeStencil | An instance of this collection can be obtained from the PointShapeStencil property of the NDrawingDocument class. It is used to hold the shapes of the points, which can be displayed by each NPointElement instances (see below). |
Related to library documents | |
NMaster | An instance of this class is used to store reusable drawing clippings. The NLibraryDocument is in fact a collection of masters. See Library Documents for more information. |
Related to shapes | |
NLabelCollection | An instance of this collection can be obtained from the Labels property of the NShape class. It is used to store the labels of a shape. See Labels for more information. |
NPortCollection | An instance of this collection can be obtained from the Ports property of the NShape class. It is used to store the ports of a shape. See Ports for more information. |
NControlPointCollection | An instance of this collection can be obtained from the ControlPoints property of the NShape class. It is used to store the control points of a shape. See Control Points for more information. |
NPrimitiveModelCollection | An instance of this collection can be obtained from the Primitives property of the NCompositeShape class. It is used to store the primitives, from which a composite shape is constructed. See Composite Shapes for more information. |
NShapeCollection | An instance of this collection can be obtained from the Shapes property of the NGroup class. It is used to store the shapes of a group. See Groups for more information. |
Stencils are collections, which contain and render some reusable content. Stencil collections are derived from the base NStencil class, which derives from NDiagramElementCollection.
Stencils are designed to be fast and can generally render two types of transformable content - predefined and custom. The predefined content is stencil specific. The custom content of each stencil is defined with the help of one or more strongly named NModel derivates, which the stencil contains.
Currently each NDrawingDocument hosts two more specialized stencils - NArrowheadShapeStencil and NPointShapeStencil. Following is a brief description of these stencils:
C# |
Copy Code
|
---|---|
// obtain the styles of the start and end arrowheads
NArrowHeadStyle startAHStyle = path.ComposeStartArrowheadStyle();
NArrowHeadStyle endAHStyle = path.ComposeEndArrowheadStyle();
|
Visual Basic |
Copy Code
|
---|---|
' obtain the styles of the start and end arrowheads Dim startAHStyle As NArrowheadStyle = path.ComposeStartArrowheadStyle() Dim endAHStyle As NArrowheadStyle = path.ComposeEndArrowheadStyle() |
C# |
Copy Code
|
---|---|
line.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.Circle, "", new NSizeL(12, 12), new NColorFillStyle(Color.Red), new NStrokeStyle(1, Color.Black)); |
Visual Basic |
Copy Code
|
---|---|
line.Style.StartArrowheadStyle = New NArrowheadStyle(ArrowheadShape.Circle, "", New NSizeL(12, 12), New NColorFillStyle(Color.Red), New NStrokeStyle(1, Color.Black)) |
C# |
Copy Code
|
---|---|
// display a custom start arrowhead with the specified name and styles line.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.Custom, "MyArrowhead", new NSizeL(12, 12), new NColorFillStyle(Color.Red), new NStrokeStyle(1, Color.Black)); // register a custom arrowhead shape in the stencil (in this case a simple rectangle) NRectangleF modelBounds = new NRectangleF(0, -1, 2, 2); NRectanglePath rect = new NRectanglePath(modelBounds); rect.Name = "MyArrowhead"; document.ArrowheadShapeStencil.AddChild(rect); |
Visual Basic |
Copy Code
|
---|---|
' display a custom start arrowhead with the specified name and styles line.Style.StartArrowheadStyle = New NArrowheadStyle(ArrowheadShape.Custom, "MyArrowhead", New NSizeL(12, 12), New NColorFillStyle(Color.Red), New NStrokeStyle(1, Color.Black)) ' register a custom arrowhead shape in the stencil (in this case a simple rectangle) Dim modelBounds As New NRectangleF(0, -1, 2, 2) Dim rect As New NRectanglePath(modelBounds) rect.Name = "MyArrowhead" document.ArrowheadShapeStencil.AddChild(rect) |