DiagramStencil.RegisterTool(ItemTool) Method
Adds the specified item tool to the stencil.
Namespace: DevExpress.Diagram.Core
Assembly: DevExpress.Diagram.v18.2.Core.dll
Declaration
public void RegisterTool(
ItemTool tool
)
Public Sub RegisterTool(
tool As ItemTool
)
Parameters
Name |
Type |
Description |
tool |
DevExpress.Diagram.Core.ItemTool |
A DevExpress.Diagram.Core.ItemTool descendant.
|
The RegisterTool method is used to register custom diagram items in the Shapes Panel. To register regular shapes, use the DiagramStencil.RegisterShape method.
The following code snippets (auto-collected from DevExpress Examples) contain references to the RegisterTool(ItemTool) 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.
how-to-create-items-with-custom-content-in-diagramcontrol-t395119/VB/DXDiagram.ContentItem/MainWindow.xaml.vb#L32
Dim stencil As New DiagramStencil("CustomTools", "Content Item Tools")
stencil.RegisterTool(New FactoryItemTool("Text", Function() "Text", Function(diagram) New DiagramContentItem() With {.CustomStyleId = "formattedTextContentItem"}, New Size(230, 110), True))
stencil.RegisterTool(New FactoryItemTool("Logo", Function() "Logo", Function(diagram) New DiagramContentItem() With {.CustomStyleId = "devExpressLogoContentItem"}, New Size(230, 80), True))
how-to-use-the-customdrawitem-event-to-draw-custom-icons-inside-diagram-items-t441104/VB/XtraDiagram.CustomDraw/Form1.vb#L28
Dim stencil = New DiagramStencil("customShapes", "Custom Shapes")
stencil.RegisterTool(New FactoryItemTool("activeTaskShape", Function() "Active Task", Function(diagram) New DiagramShapeEx With {.Content = "Active Task", .Status = Status.Active}, New System.Windows.Size(150, 100), False))
stencil.RegisterTool(New FactoryItemTool("inactiveTaskShape", Function() "Inactive Task", Function(diagram) New DiagramShapeEx With {.Content = "Inactive Task", .Status = Status.Inactive}, New System.Windows.Size(150, 100), False))
how-to-create-a-diagramshape-descendant-with-editable-and-serializable-properties-t395040/VB/DXDiagram.CustomShapeProperties/MainWindow.xaml.vb#L16
Dim stencil = New DevExpress.Diagram.Core.DiagramStencil("CustomStencil", "Custom Shapes")
stencil.RegisterTool(New FactoryItemTool("CustomShape", Function() "Custom Shape", Function(diagram) New DiagramShapeEx(), New System.Windows.Size(230, 110), False))
DevExpress.Diagram.Core.DiagramToolboxRegistrator.RegisterStencil(stencil)
how-to-create-a-diagramshape-descendant-and-serialize-its-properties-t361265/VB/XtraDiagram.CustomShapeProperties/Form1.vb#L42
Dim stencil = New DevExpress.Diagram.Core.DiagramStencil("CustomStencil", "Custom Shapes")
stencil.RegisterTool(New FactoryItemTool("CustomShape", Function() "Custom Shape", Function(diagram) New DiagramShapeEx(), New System.Windows.Size(230, 110), False))
DevExpress.Diagram.Core.DiagramToolboxRegistrator.RegisterStencil(stencil)
See Also