Skip to main content

DiagramStencil.RegisterShape(ShapeDescriptionBase) Method

Adds the specified shape to the stencil.

Namespace: DevExpress.Diagram.Core

Assembly: DevExpress.Diagram.v23.2.Core.dll

NuGet Package: DevExpress.Diagram.Core

Declaration

public void RegisterShape(
    ShapeDescriptionBase shape
)

Parameters

Name Type Description
shape ShapeDescriptionBase

A ShapeDescriptionBase descendant representing the shape to add to the stencil.

Remarks

The example below illustrates how to add an SVG shape to a stencil.

//create or get the stencil you want to add your SVG to
    var stencil = DiagramToolboxRegistrator.GetStencil("SvgShapes");

    //open the file here
    using (Stream file = File.OpenRead(filePathToSVGFile)) {
        String id = "SVGid";
        String name = "SVGname";

        //create your shapeDescription with the SVG
        var shapeDescription = ShapeDescription.CreateSvgShape(id, name, file, false);

        //add the shapeDescription to your stencil
        stencil.RegisterShape(shapeDescription);
    }

To register custom diagram items, use the DiagramStencil.RegisterTool method.

The following code snippets (auto-collected from DevExpress Examples) contain references to the RegisterShape(ShapeDescriptionBase) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also