NShape Reference
ShapeType Constructor

<< Click to Display Table of Contents >>

Navigation:  Class Reference > Namespace Dataweb.NShape.Advanced > ShapeType Class >

NShape Reference
ShapeType Constructor

Previous pageReturn to chapter overviewNext page

Constructs a shape type.

Syntax

public ShapeType(string name, string libraryName, ResourceString categoryTitle, 
 CreateShapeDelegate createShapeDelegate, GetPropertyDefinitionsDelegate getPropertyDefinitionsDelegate)

public ShapeType(string name, string libraryName, ResourceString categoryTitle, 
 ResourceString description, CreateShapeDelegate createShapeDelegate, 
 GetPropertyDefinitionsDelegate getPropertyDefinitionsDelegate)

public ShapeType(string name, string libraryName, ResourceString categoryTitle, 
 CreateShapeDelegate createShapeDelegate, GetPropertyDefinitionsDelegate getPropertyDefinitionsDelegate, 
 bool supportsTemplates)

public ShapeType(string name, string libraryName, ResourceString categoryTitle, 
 CreateShapeDelegate createShapeDelegate, GetPropertyDefinitionsDelegate getPropertyDefinitionsDelegate, 
 Bitmap freehandReferenceImage)

public ShapeType(string name, string libraryName, ResourceString categoryTitle, 
 ResourceString description, CreateShapeDelegate createShapeDelegate, 
 GetPropertyDefinitionsDelegate getPropertyDefinitionsDelegate, Bitmap freehandReferenceImage)

public ShapeType(string name, string libraryName, ResourceString categoryTitle, 
 CreateShapeDelegate createShapeDelegate, GetPropertyDefinitionsDelegate getPropertyDefinitionsDelegate, 
 Bitmap freehandReferenceImage, bool supportsTemplates)

public ShapeType(string name, string libraryName, ResourceString categoryTitle, ResourceString description, 
 CreateShapeDelegate createShapeDelegate, GetPropertyDefinitionsDelegate getPropertyDefinitionsDelegate, 
 Bitmap freehandReferenceImage, bool supportsTemplates)

Parameters

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.
Not used in this version.

supportsTemplates

Indicates whether automatic templates are to be created for this shape type. The default is true.

Example

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);

See also

Concepts: Understanding Shape Creation