A ControlNode instance can host any .NET control derived from System.Windows.Forms.Control. This allows you to use ready-made controls to display or edit the entities represented in your application's diagrams. The controls hosted in MindFusion.Diagramming nodes might be interactive and with embedded user interface. For example you might utilize calendars, grids, rich-text controls or html-pages as entity editors or viewers. You might also create your own custom control and integrate it seamlessly with MindFusion.Diagramming; as a result you can get as advanced entity-relationship diagram editor as your application needs.
To allow end-users to draw ControlNode objects with the mouse, set Behavior to either DrawControls or LinkControls. The type of controls to be created in the host nodes is specified via the DefaultControlType property of DiagramView. If the following code executes, each node drawn by users would host a DataGrid instance, and nodes could be connected by drawing links between them:
C#
![]() |
---|
// Draw datagrid nodes and allow connecting them with links // Mouse clicks on hosted controls are processed by MindFusion.Diagramming |
Visual Basic
![]() |
---|
' Draw datagrid nodes and allow connecting them with links |
To create a ControlNode programmatically, add an instance of the class to the diagram's Nodes collection and set its Control property to an instance of a Control-derived class. A hosted control can be replaced with another one by assigning to Control again.
Hosted controls are like any other child controls in a form, which leads to the following consequences: