<< Click to Display Table of Contents >> NShape Reference
|
Constructs a shape type.
public ShapeType(string name, string libraryName, ResourceString categoryTitle, |
public ShapeType(string name, string libraryName, ResourceString categoryTitle, |
public ShapeType(string name, string libraryName, ResourceString categoryTitle, |
public ShapeType(string name, string libraryName, ResourceString categoryTitle, |
public ShapeType(string name, string libraryName, ResourceString categoryTitle, |
public ShapeType(string name, string libraryName, ResourceString categoryTitle, |
public ShapeType(string name, string libraryName, ResourceString categoryTitle, ResourceString description, |
Name |
Description |
---|---|
name |
Name of the shape type |
libraryName |
Name of the library where the shape type is implemented. |
defaultCategoryTitle |
Category in the toolbox where the default tool will be created |
createShapeDelegate |
Function that creates a shape of this type |
getPropertyDefinitionsDelegate |
Function that retrieves the property definitions of the conceptual entity. |
freehandReferenceImage |
A System.Drawing.Bitmap image serving as a reference for freehand drawings. The default is null. |
supportsTemplates |
Indicates whether automatic templates are to be created for this shape type. The default is true. |
In the NShapeLibraryInitializer.Initialize method of a library, a shape type is usually created like this:
ShapeType myShapeType = new ShapeType(
"MyShape", // The name of the shape type, used
"MyShpeLibrary", // The name of the library the shape type belongs to
"My Shapes", // Name of the default toolbox category
delegate(ShapeType shapeType, Template t) { // A 'CreateShapeDelegate' method that constructs the shape
return new MyShape(shapeType, t);
},
MyShape.GetPropertyDefinitions, // Static method that provides property definitions
true); // Specifies whether templates can be created from this shape
The created ShapeType instance has to be registered with the given IRegistrar instance:
registrar.RegisterShapeType(myShapeType);