All shape factories share a common set of features implemented by the abstract NShapesFactory class, which is the base class for all types of shape factories. Following is a brief summary:
You can easily obtain the count of distinct shape, which can be produced by the factory with the help of the ShapesCount property.
You can also obtain information about the shape at a specified index with the help of the GetShapeInfo method - returns an instance of the NShapeInfo class.
A shape from a shape factory can be created with the help of the CreateShape method. The one and only parameter is the index of the shape which must be created. The following code example creates a pentagram shape:
C# |
Copy Code
|
---|---|
// create a pentagram NBasicShapesFactory factory = new NBasicShapesFactory(document); NShape shape = factory.CreateShape((int)BasicShapes.Pentagram); |
Visual Basic |
Copy Code
|
---|---|
' create a pentagram Dim factory As New NBasicShapesFactory(document) Dim shape As NShape = factory.CreateShape(BasicShapes.Pentagram) |