# MindFusionDoc Documentation Map
This is a unified documentation resource optimized for LLMs. The high-level guides, architectural overviews, and tutorials are inlined directly below in Section 1. All class references are merged into single files per class/struct and linked in Section 2.
# Section 1: High-Level Guides and Overviews
## Untitled Topic -1
## Introduction
MindFusion.Diagramming is a reusable software component that lets you create and display various types of diagrams and charts. It is implemented as a .NET control and can be easily integrated into any application targeting the Microsoft .NET platform. By providing your software with ready to use capabilities for visualizing and editing relational data, MindFusion.Diagramming saves you from hundreds of hours of coding and debugging efforts.
MindFusion.Diagramming can give graphical representation to:
- Workflow processes
- Class relationships
- Graphs and networks
- Entity-relationship / database diagrams
- IVR systems
- Industrial automation processes
- Genealogy trees
- Algorithms and flowcharts
- Organizational charts
- XML documents
- Classification hierarchies
- And much more
MindFusion.Diagramming provides intuitive user-interaction model for creating or editing diagrams. In addition, its programmatic interface places at your disposal many useful functions, ranging from printing and XML serialization to path-finding and automatic layout algorithms.
The control has been tested with the most popular .NET development environments and programming languages, and is used by companies from all around the world to create applications in C#, VB.NET and Delphi.NET.
## General Information
### The MindFusion.Diagramming Component
- Redistribution is royalty free
- Assembly is strong-named
- Can be purchased with source code
- Is written in C#
- Implements the Document/View architecture
- Supports the Mono runtime
### User Interaction
- Several user interaction modes
- Free-form drawing
- Free-form selection mode
- Scrolling and zooming
- Copy and paste to/from Windows clipboard
- Panning
- Automatic scrolling while dragging items with the mouse
- Alignment to grid
- Node alignment guides
- Multiple selection
- Tool-tips
- Docking points can be defined for nodes
- Magnifier tool
- Undo / redo support
- Rotate and flip shapes
- Run animations in response to users' actions
- Multi-touch gestures
### Programming
- Programmatic access to the diagram elements
- Extension methods for fluent API
- Numerous properties for customizing appearance and behavior
- Numerous utility methods
- Path finding and cycle detection
- Rich event set
### Store and Retrieve Diagrams into/from
- Files on disk
- .NET streams
- ASCII strings
- XML documents
- JSON strings
### Output
- To display in Windows Forms
- Display graphs in 3D
- Printing and print preview
- To a browser using HTML image maps
- Create bitmap images
### Import and Export
- Export images in bmp, jpeg, gif, tiff, png formats
- Export Drawing Exchange Format (DXF) files
- Export Scalable Vector Graphics (SVG) files
- Export Portable Document Format (PDF) files
- Export Adobe Flash (SWF) files
- Export Windows Metafile (WMF) drawings
- Export Visio 2003 VDX files
- Export Visio 2013 VSDX files
- Export Excel Open XML Format (XLSX) files
- Import Scalable Vector Graphics (SVG) files
- Import Visio 2003 VDX files
- Import Visio 2013 VSDX files
- Import OpenOffice Draw (ODG) files
### Diagram Elements
- More than 100 predefined node shapes
- Display SVG drawings in nodes
- Ability to define custom shapes and shape libraries
- Rotation of nodes at arbitrary angles
- Container nodes
- Tables with unlimited number of rows and columns
- Table cells can span several columns and rows
- Display maps from ESRI shapefiles
- Display maps in OpenStreetMap format
- Display hierarchical data in TreeView nodes
- Display shapes from Visio stencil files
- Assign diagram items to layers
- Sections of table rows can be expanded or collapsed
- Control hosts allow using .NET controls as diagram nodes
- Links can comprise multiple segments
- Link segments can be straight lines or curves
- Display multiple labels per link
- Support for custom node and link types
### Automatic Layout
- Spring-Embedder graph layout
- Directional tree layout
- Horizontal/vertical binary tree layout
- Radial tree layout
- Fractal tree layout
- Layered graph layout
- Grid layout
- Simulated Annealing graph layout
- One-way graph layout
- Orthogonal graph layout
- Circular graph layout
- Orthogonal link router
- Source code flowchart layout
- Decision flowchart layout
- Process diagrams layout
- Tree map layout
- Swimlane diagrams layout
- Topological graph layout
- Triangular graph layout
- Hierarchical graph layout
- Cascading graph layout
- Multi-level graph layout
- Automatic link routing
### Appearance
- Styles and themes
- Nodes can display images and text
- Multiple text labels per item
- Various text alignment styles
- Text can be laid out in polygonal areas
- Styled HTML-like text formatting
- Customizable fonts and colors
- Custom painting of nodes
- Shadows
- User-assigned mouse cursors
- Z-order
- Rich choice of pen and brush styles
- Transparent nodes
- Invisible nodes
- Embossment and shadow dispersion visual effects
- A background lane grid
### Behavior
- Lock diagram elements
- Read-only mode supported
- Tables can be scrolled
- Collapse and expand hierarchy branches
- In-place text editing
- Dynamic positioning of links relative to connected nodes
### Link Diagram Items
- Nodes to nodes
- Table rows to table rows
- Nodes to table rows
- Unconnected links
### Hierarchical Grouping
- Attaching nodes to other nodes
- Attaching nodes to link control points
- Attaching nodes to link segments
### Auxiliary Controls
- Overview control
- Ruler control
- Shapes toolbar
- Shapes listbox
- Node list control
- Layer list control
- Zoom control
- ItemListView control
- Palette control
## Getting Started
The following topics describe how to integrate the Diagramming for WinForms API into your project, and create an instance of the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) control.
## Add Diagram Assemblies
You can add diagram library's .NET assemblies to your project either from the (#add-nuget-package) repository, or from (#add-local-assemblies) installed distribution
## Add Nuget Package
In order to integrate Diagramming for WinForms into your Visual Studio project, select Manage Nuget Packages from Project menu:
Open the Browse tab, and enter MindFusion.Diagramming in the search field. Select the MindFusion.Diagramming package and click Install. If you plan to use other MindFusion components along with the diagram (such as calendar, spreadsheet, report), select MindFusion.Pack.WinForms instead:
Once the package is installed, you should be able to add controls from the library to your UI ((Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md), (Markdown/T_MindFusion_Diagramming_WinForms_NodeListView.md), (Markdown/T_MindFusion_Diagramming_WinForms_Overview.md), etc).
## Add Local Assemblies
If you have installed Diagramming for WinForms distribution locally and your project targets .NET 4, you should be able to see controls from the API in Visual Studio toolbox and can start using them by dragging to Form Designer. If targeting CoreCLR (.NET 5+), locally installed assemblies do not show in the toolbox at this time, and you must add references to them manually in order to use the diagramming API. To do so, select the Add Project Reference command from Project menu:
In Reference Manager, select the Browse tab and click the Browse button. Navigate to the Diagramming for WinForms install location, select assemblies for respective .NET version and click Add:
Once assembly references have been added, you should be able to add controls from the library to your UI ((Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md), (Markdown/T_MindFusion_Diagramming_WinForms_NodeListView.md), (Markdown/T_MindFusion_Diagramming_WinForms_Overview.md), etc).
## Create DiagramView Instance
After following one of the previous topics, you should be able to create a (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) instance in your WinForms UI.
### Add a DiagramView from code
Open your form's code file.
- Import (#mindfusiondiagramming) and (#mindfusiondiagrammingwinforms) namespaces.
- In form's constructor, create a (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) and add it to form's Controls collection.
```csharp
using MindFusion.Diagramming;
using MindFusion.Diagramming.WinForms;
public partial class DiagramForm : Form
{
DiagramView diagramView;
public DiagramForm()
{
InitializeComponent();
diagramView = new DiagramView();
diagramView.Dock = DockStyle.Fill;
Controls.Add(diagramView);
}
.....
```
### Add a DiagramView from toolbox
If you have installed the library locally and targeting .NET 4, or added the MindFusion.Diagramming Nuget package, you should be able to add (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) control from the Visual Studio toolbox:
Open the Visual Studio form designer.
- Open the toolbox (Ctrl + Alt + X).
- Select and drag the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) icon to your form.
- Select and drag the (Markdown/T_MindFusion_Diagramming_Diagram.md) icon to your form. A (Markdown/T_MindFusion_Diagramming_Diagram.md) instance represents the diagram model, and is also used to subscribe to events such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodecreated) (which are view-agnostic).
- Select the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) and set its (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#diagram) property to the (Markdown/T_MindFusion_Diagramming_Diagram.md) instance.
### Customize the diagram properties
Now you can set the properties of the (Markdown/T_MindFusion_Diagramming_Diagram.md) and the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) in the 'Properties' window or from code.
- Start with the 'Name' property, which defines the name of the variable you will use to access the objects from code.
- Choose a value for the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md), which defines how the view must interpret actions done with the mouse by users of your application. The default value (Markdown/T_MindFusion_Diagramming_Behavior.md) specifies that users can draw shape nodes and connect them with links. Another value - (Markdown/T_MindFusion_Diagramming_Behavior.md) - allow drawing tables and relations. (Markdown/T_MindFusion_Diagramming_Behavior.md) bans users from drawing new items, but allows them to modify existing ones.
- Customize the appearance of your diagram by setting properties from the 'Appearance' category, such as (Markdown/T_MindFusion_Diagramming_Diagram.md#showgrid) or (Markdown/T_MindFusion_Diagramming_Diagram.md#backbrush).
- Properties from the diagram's 'Defaults' category specify initial values for the properties of diagram elements.
You are now ready to write code. A good place to start is in event handlers - either (Markdown/T_MindFusion_Diagramming_DiagramBase.md#diagrambase-events) raised by the (Markdown/T_MindFusion_Diagramming_Diagram.md) component whose handlers let you run business logic for diagram modifications, or events raised by other user interface elements in your application whose handlers modify the diagram or view. The events exposed by MindFusion.Diagramming are listed in the 'Events' tab of the 'Properties Window' if your project is in C#. If using VB.NET, MindFusion.Diagramming events handlers can be created by selecting the (Markdown/T_MindFusion_Diagramming_Diagram.md) instance and any of its events in the top-side combo boxes of the code editor.
Browse the other sections of this help file to learn more about the functionality provided by the MindFusion.Diagramming classes, methods and properties. Follow the (#tutorials) to learn how to populate the diagram model programmatically or create custom item types.
## Moving to MindFusion.Diagramming 6
The following topics describe the changes you need to do when moving from version 5 to version 6 of the control.
## Changes in Control's Behavior
### Custom drawing
It is now recommended to override (Markdown/T_MindFusion_Diagramming_DiagramNode.md#drawlocal) and (Markdown/T_MindFusion_Diagramming_DiagramNode.md#drawshadowlocal) methods (instead of (Markdown/T_MindFusion_Diagramming_DiagramNode.md#draw) and (Markdown/T_MindFusion_Diagramming_DiagramNode.md#drawshadow)) in custom node types. Overriding (Markdown/T_MindFusion_Diagramming_DiagramNode.md#drawlocal) will provide you with built-in support for node rotation. The overrides should draw relatively to the bounding rectangle returned by (Markdown/T_MindFusion_Diagramming_DiagramNode.md#getlocalbounds). Overriding (Markdown/T_MindFusion_Diagramming_DiagramNode.md#draw) still works, but any custom drawing code would have to apply a rotation transform corresponding to the node's (Markdown/T_MindFusion_Diagramming_DiagramNode.md#rotationangle) value.
If your application implements custom drawing via the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawnode) event handler, note that the (Markdown/T_MindFusion_Diagramming_DrawNodeEventArgs.md#bounds) value provided as event argument is now relative to the node and not to the diagram.
The provided (Markdown/T_MindFusion_Diagramming_DrawNodeEventArgs.md#graphics) object will have translation and rotation transformations applied at the time when (Markdown/T_MindFusion_Diagramming_DiagramNode.md#drawlocal) is called or (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawnode) is raised. If you need your custom graphics elements to ignore the rotation angle, you should save the Graphics state, reset current transform, draw the elements and finally, restore the graphics state.
### Z order
A significant change in the control's behavior is that it now allows different items to have the same (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zindex) values. You must revise your code if it relies on (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zindex) being unique or corresponding to the item's position within the (Markdown/T_MindFusion_Diagramming_Diagram.md#items) collection.
### Beware of Null Property Values
(Markdown/T_MindFusion_Diagramming_DiagramItem.md#brush), (Markdown/T_MindFusion_Diagramming_DiagramItem.md#pen) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#font) properties of diagram items now have null values by default. This allows items to be skinned via styles and themes. If you need to set a specific object member of one of these properties, you must assign a new object instance to the respective property. For example, such code might throw an exception now:
```csharp
node.Pen.Color = Color.Black;
node.Pen.Width = 3;
```
You must replace it with the following:
```csharp
node.Pen = new Pen(Color.Black, 3);
```
When drawing custom graphic elements for an item, use the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#effectivebrush), (Markdown/T_MindFusion_Diagramming_DiagramItem.md#effectivepen) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#effectivefont) properties to access the objects that should be used for drawing - whether they come from local property values, from the item's (Markdown/T_MindFusion_Diagramming_DiagramItem.md#style) or from a (Markdown/T_MindFusion_Diagramming_Theme.md) applied to the diagram.
## API Changes
### Removed delegates
Delegate types that used to define events have been removed. Events are now defined using the generic EventHandler delegate with the respective EventArgs-derived type as argument. For example, (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodecreated) is now defined as follows:
```csharp
public event EventHandler NodeCreated;
```
The follow list shows all delegate types that have been removed:
- ControlNodeEventHandler
- CopyHostedControlEventHandler
- InPlaceEditEventHandler
- PaintControlEventHandler
- AnchorPointEventHandler
- AreaEventHandler
- CellEventHandler
- CellValidationEventHandler
- ClipboardEventHandler
- ContainerChildEventHandler
- DiagramEventHandler
- DrawAnchorPointEventHandler
- DrawCellEventHandler
- DrawItemEventHandler
- DrawLinkEventHandler
- DrawNodeEventHandler
- EditCellTextEventHandler
- EditLinkTextEventHandler
- EditNodeTextEventHandler
- GroupEventHandler
- HitTestEventHandler
- InstantiateItemEventHandler
- ItemEventHandler
- LinkEventHandler
- LinkValidationEventHandler
- NodeEventHandler
- NodeValidationEventHandler
- RepaintEventHandler
- RowEventHandler
- SerializeTagEventHandler
- ShapeEventHandler
- TimerEventHandler
- TreeItemEventHandler
- TreeItemValidationEventHandler
- UndoEventHandler
- UndoValidationEventHandler
- ValidationEventHandler
Removed delegates in the MindFusion.Diagramming.Import namespace:
- ConnectorImportedEventHandler
- GroupImportedEventHandler
- ShapeImportedEventHandler
Removed delegates in the MindFusion.Diagramming.Lanes namespace:
- CellBoundsEventHandler
### Renamed types and members
The following table lists the renamed types.
| **Old name
** | **New name
**
| LinkStyle
| (Markdown/T_MindFusion_Diagramming_LinkStyle.md)
| TableStyle
| (Markdown/T_MindFusion_Diagramming_SimpleShape.md)
| GroupImportedArgs
| (Markdown/T_MindFusion_Diagramming_Import_GroupImportedArgs.md)
The following types were moved from the (#mindfusiondiagrammingcomponents) to the (#mindfusiondiagramming) namespace:
- (Markdown/T_MindFusion_Diagramming_Components_NotifyCollectionChangedAction.md)
- (Markdown/T_MindFusion_Diagramming_Components_NotifyCollectionChangedEventArgs.md)
- (Markdown/T_MindFusion_Diagramming_Components_ObservableCollection.md)
The following table lists the renamed members.
| **Old name (old type)
** | **New name (new type)
**
| Diagram.TableStyle (TableStyle)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tableshape) ((Markdown/T_MindFusion_Diagramming_SimpleShape.md))
| Diagram.LinkStyle (LinkStyle)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkshape) ((Markdown/T_MindFusion_Diagramming_LinkStyle.md))
| DiagramLink.Style (LinkStyle)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#shape) ((Markdown/T_MindFusion_Diagramming_LinkStyle.md))
| TableNode.Style (TableStyle)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#shape) ((Markdown/T_MindFusion_Diagramming_SimpleShape.md))
| TreeViewItem.LabelColor (Color)
| (Markdown/T_MindFusion_Diagramming_TreeViewItem.md#labelbrush) ((Markdown/T_MindFusion_Drawing_Brush.md))
| ContainerNode.CaptionColor (Color)
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#captionbrush) ((Markdown/T_MindFusion_Drawing_Brush.md))
| TableNode.CaptionColor (Color)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#captionbrush) ((Markdown/T_MindFusion_Drawing_Brush.md))
| DiagramItem.TextColor (Color)
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush) ((Markdown/T_MindFusion_Drawing_Brush.md))
| DiagramItem.ShadowColor (Color)
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#shadowbrush) ((Markdown/T_MindFusion_Drawing_Brush.md))
The z-order related methods in the (Markdown/T_MindFusion_Diagramming_DiagramItem.md) class now also accept a single boolean argument.
### Collections
Several collections have been converted to generic types. The table below provides an overview of this change.
| **Old signature
** | **New signature
**
| ItemCollectionBase
| (Markdown/T_MindFusion_Diagramming_ItemCollectionBase.md)
| PersistableCollection
| (Markdown/T_MindFusion_Diagramming_PersistableCollection.md)
| ReadOnlyCollection
| (Markdown/T_MindFusion_Diagramming_ReadOnlyCollection.md)
In addition the collection classes no longer implement IList and ICollection. Calls that expect those interfaces will result in compilation errors. The collection classes also do not expose the Capacity property.
## Default Values
### Default values
With the introduction of the new style system, the following default-value properties in the (Markdown/T_MindFusion_Diagramming_Diagram.md) class are considered obsolete and will no longer have any effect on newly created items:
- (Markdown/T_MindFusion_Diagramming_Diagram.md#shapepen)
- (Markdown/T_MindFusion_Diagramming_Diagram.md#shapebrush)
- (Markdown/T_MindFusion_Diagramming_Diagram.md#linkpen)
- (Markdown/T_MindFusion_Diagramming_Diagram.md#linkbrush)
- (Markdown/T_MindFusion_Diagramming_Diagram.md#tablepen)
- (Markdown/T_MindFusion_Diagramming_Diagram.md#tablebrush)
- (Markdown/T_MindFusion_Diagramming_Diagram.md#shadowbrush)
- (Markdown/T_MindFusion_Diagramming_Diagram.md#font)
- TextColor
To provide the same functionality as those properties did before, use a (Markdown/T_MindFusion_Diagramming_Theme.md) object with styles associated with the appropriate diagram item types. For example, to provide default pen for shape nodes, use the following code:
```csharp
ShapeNodeStyle defaultStyle = new ShapeNodeStyle();
defaultStyle.Stroke = ...;
defaultStyle.StrokeThickness = ...;
Theme theme = new Theme();
theme.RegisterStyle(typeof(ShapeNode), defaultStyle);
diagram.Theme = theme;
```
```
Dim defaultStyle As New ShapeNodeStyle()
defaultStyle.Stroke = ...
defaultStyle.StrokeThickness = ...
Dim theme As New Theme()
theme.RegisterStyle(GetType(ShapeNode), defaultStyle)
diagram.Theme = theme
```
For convenience, the (Markdown/T_MindFusion_Diagramming_Diagram.md#createthemefromdefaults) method of the (Markdown/T_MindFusion_Diagramming_Diagram.md) class can create this (Markdown/T_MindFusion_Diagramming_Theme.md) object from the diagram's current default values.
Alternatively, you can set the default values through a set of shortcut properties in the (Markdown/T_MindFusion_Diagramming_Diagram.md) class. These shortcut properties create a (Markdown/T_MindFusion_Diagramming_Theme.md) object internally, register the appropriate classes and assign the theme to the diagram. The following table illustrates this.
| **Old property
** | **New equivalent
**
| (Markdown/T_MindFusion_Diagramming_Diagram.md#shapepen)
| (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#stroke)
(Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#strokethickness)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#shapebrush)
| (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#brush)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkpen)
| (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#stroke)
(Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#strokethickness)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkbrush)
| (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#brush)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tablepen)
| (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#stroke)
(Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#strokethickness)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tablebrush)
| (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#brush)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#shadowbrush)
| (Markdown/T_MindFusion_Diagramming_DiagramStyle.md#shadowbrush)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#font)
| (Markdown/T_MindFusion_Diagramming_DiagramStyle.md#fontfamily)
(Markdown/T_MindFusion_Diagramming_DiagramStyle.md#fontsize)
(Markdown/T_MindFusion_Diagramming_DiagramStyle.md#fontstyle)
(Markdown/T_MindFusion_Diagramming_DiagramStyle.md#fontunit)
| Diagram.TextColor
| (Markdown/T_MindFusion_Diagramming_DiagramStyle.md#textbrush)
The (Markdown/T_MindFusion_Diagramming_DiagramItem.md#font), (Markdown/T_MindFusion_Diagramming_DiagramItem.md#brush), and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#pen) properties of diagram items are no longer guaranteed to be non-null. In fact their default value is now null, so replace these properties with their (Markdown/T_MindFusion_Diagramming_DiagramItem.md#effectivefont), (Markdown/T_MindFusion_Diagramming_DiagramItem.md#effectivebrush), and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#effectivepen) counterparts.
## MindFusion.Diagramming Editions
MindFusion.Diagramming is available in two editions - Standard and Professional.
Use MindFusion.Diagramming Standard edition to create and present all sorts of flow diagrams according to your application requirements.
The Professional edition is designed for maximum performance while still providing the functionality and productivity of MindFusion.Diagramming Standard version. It features a selection of programming options that provide your application with even richer user interface, advanced layout and graph analysis capabilities as well as extended set of import and export libraries. The features listed below are exclusive to MindFusion.Diagramming Pro:
- Support for multi-level undo and redo
- Graph layout and analysis
- Spring-Embedder graph layout algorithm
- Layered graph layout algorithm
- Grid layout algorithm
- Simulated Annealing layout algorithm
- Path-finding and cycle detection
- Source code flowchart layout algorithm
- Decision flowchart layout algorithm
- Tree map layout algorithm
- Process diagram layout algorithm
- Swimlane diagrams layout algorithm
- One-way graph layout algorithm
- Orthogonal graph layout algorithm
- Circular graph layout algorithm
- Triangular graph layout algorithm
- Hierarchical graph layout algorithm
- Cascading graph layout algorithm
- A suite of auxiliary controls
- (Markdown/T_MindFusion_Diagramming_WinForms_Overview.md) control
- (Markdown/T_MindFusion_Diagramming_WinForms_Ruler.md) control
- (Markdown/T_MindFusion_Diagramming_WinForms_ShapeToolBar.md) control
- (Markdown/T_MindFusion_Diagramming_WinForms_ShapeListBox.md) control
- (Markdown/T_MindFusion_Diagramming_WinForms_NodeListView.md) control
- (Markdown/T_MindFusion_Diagramming_WinForms_LayerListView.md) control
- (Markdown/T_MindFusion_Common_WinForms_ZoomControl.md) control
- (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) control
- (Markdown/T_MindFusion_Diagramming_WinForms_Palette.md) control
- Import and export components
- Visio 2003 XML Drawing import component
- Visio 2013 XML Drawing import component
- Visio 2003 XML Drawing export component
- SVG export component
- DXF export component
- PDF export component
- Adobe Flash export component
- WMF export component
The trial version of MindFusion.Diagramming demonstrates features available in both editions of the control; all classes and class members available only in MindFusion.Diagramming Pro are clearly marked in the documentation and throughout the samples.
## User Interaction with the Diagram
Most likely an application would use MindFusion.Diagramming to enable users to interactively create diagrams, flowcharts and other kinds of presentation documents. A user composes or edits a diagram by drawing its elements on the MindFusion.Diagramming canvas area. With the help of a mouse or another pointing device users draw shapes, tables and links, possibly connecting them in complex hierarchies, graphs, trees or other structures they might need.
### Creating New Items
New items can be created by drawing them with the mouse. While a user drags the mouse, the view of the control is updated to show what the new item would look like at the pointer location. If the operation cannot be completed at the current mouse position, the cursor changes to a crossed out circle. When the user releases the button, the item is created. The control does not let users create very tiny nodes which would be hard to select and modify. By default links can be drawn only between nodes, unless the (Markdown/T_MindFusion_Diagramming_Diagram.md#allowunconnectedlinks) property is enabled. Users can cancel item creation by pressing the right mouse button while drawing.
### Modifying Items
A user modifies an item by dragging its manipulation handles. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#modificationstart) property specifies when these handles appear. The first option, (Markdown/T_MindFusion_Diagramming_ModificationStart.md), makes the handles appear when the mouse hovers over an item; modification of the item can start immediately by pointing it and dragging a handle. The second option is (Markdown/T_MindFusion_Diagramming_ModificationStart.md): in order to be modified, an item should first be selected. Manipulation handles appear around the item to indicate that now it can be moved or resized. Number and functionality of those handles depend on the item type and the value of the corresponding (Markdown/T_MindFusion_Diagramming_DiagramNode.md#handlesstyle) property. What the user sees while moving or resizing items can be customized further by setting the (Markdown/T_MindFusion_Diagramming_Diagram.md#modificationeffect) property.
### Modifying a Node
Usually nodes have nine adjustment handles. The one at the center can be used to move the node. When dragged, each corner handle resizes the node by moving the two edges adjacent to the corresponding corner. The edge handles placed at the center of each side can be used to resize a node either horizontally or vertically. Shape nodes can be rotated using an additional round handle drawn above them. Each handle can be enabled or disabled by setting or clearing the respective bit in (Markdown/T_MindFusion_Diagramming_DiagramNode.md#enabledhandles).
### Modifying a Link
Variety and behavior of link adjustment handles depend on the link's (Markdown/T_MindFusion_Diagramming_DiagramLink.md#shape) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#segmentcount). Control-points stay at both ends of each segment that constitutes a link. MindFusion.Diagramming offers three link styles. Following sections discuss how to modify links of each style.
- The first style called (Markdown/T_MindFusion_Diagramming_LinkStyle.md) defines links, which consist of a series of straight segments, drawn between control-points. There are no restrictions as to the number of segments. Dragging a control-point modifies each segment adjacent to the point. If the (Markdown/T_MindFusion_Diagramming_Diagram.md#allowsplitlinks) property is enabled, users are allowed to insert new control points or to remove existing ones. Inserting a control point is done by pressing the left mouse button over a segment and dragging. The new point appears at the mouse location and splits the pointed segment in two.
- If link's style is set to (Markdown/T_MindFusion_Diagramming_LinkStyle.md), each segment has 4 manipulation handles that define a curve. Each curve goes through the end-points, which are shaped as circles. Bend of the curve is defined by the middle two points shaped as rectangles. If a user drags an end-point modification handle, the adjacent control points will be moved with same translation vector as that of the end-point. If a bend control point is dragged, the symmetric control point of the neighboring curve is also moved to ensure the two stay on the same line with the end-point and on the same distance from it.
- (Markdown/T_MindFusion_Diagramming_LinkStyle.md) links consist of straight horizontal and vertical segments, each one orthogonal to its neighbors. If a control-point is dragged, the segments adjacent to it are moved and resized preserving their orthogonal orientation to each other. If the (Markdown/T_MindFusion_Diagramming_Diagram.md#allowsplitlinks) property is enabled, users are allowed to insert new control points to (Markdown/T_MindFusion_Diagramming_LinkStyle.md) links or remove existing ones. The orientation of the link segments can be changed if (Markdown/T_MindFusion_Diagramming_DiagramLink.md#cascadeorientation) is set to (Markdown/T_MindFusion_Diagramming_Orientation.md).
### Modifying a Table
Table modification handles are drawn as dotted lines over its borders. Dragging table's caption bar moves it. Dragging any table's side or corner resizes it.
### Selecting Items
Multiple items are selected by dragging while CTRL key is down. Selection can also be toggled with CTRL + clicking an item. A rectangle appears around selected items, allowing a user to move all of them at once.
### Scrolling and Panning
If the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#showscrollbars) property is enabled, scrollbars are displayed, which can be used by a user to scroll the diagram's drawing area. Pressing the left mouse button and dragging while the ALT key is down scrolls the diagram too.
### Interpreting Users Actions
Mouse operations can be interpreted in different ways depending on the value of the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property. It defines whether for example dragging the mouse creates a node or selects existing items. Check the property description for more information.
## Licensing
There are no separate trial builds of MindFusion assemblies. When you purchase a component you can find the license key for this component listed on the Keys & Downloads page at the customer's portal. Assign this license key to the LicenseKey property to disable the component's evaluation mode and stop displaying trial messages. If your application contains more than one MindFusion component, you could call MindFusion.Licensing.LicenseManager.AddLicense(key) method from application start-up code to specify the key once instead of setting it per each control.
## Programming Interface Overview
The next few chapters give you an overview of all features, grouped by functionality. Hyperlinks refer to the detailed description of methods and properties of each class.
## Document-View Architecture
MindFusion.Diagramming implements the Model-View-Controller (MVC) architectural pattern in its new version 5. The MVC design pattern as applied to MindFusion.Diagramming separates the diagram data (model) from its representation to the user (view) and controlling it by the user (controller).
### Single Diagram Canvas
The (Markdown/T_MindFusion_Diagramming_Diagram.md) class represents the diagram data model and provides operations to process the data. It exposes properties and methods for adding new diagram elements, finding and accessing existing elements, or removing them.
The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) class presents the relevant data from the (Markdown/T_MindFusion_Diagramming_Diagram.md) class by drawing on the screen using .NET GDI+. When the diagram is changed, the view automatically redraws the affected part of the image to reflect the changes. Multiple views can display the same diagram, set by their (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#diagram) property. Each view can have a different zoom level and scroll position.
The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) class also integrates the Controller part of the MVC, represented mostly by the view's (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property. That property specifies how GUI actions to manipulate the data should be interpreted.
### Multiple Diagram Pages
The (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) class represents a collection of diagram pages or sheets, represented by (Markdown/T_MindFusion_Diagramming_DiagramPage.md) objects. Document's pages are stored in its (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#pages) collection. The (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#savetoxml) and (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#savetofile) methods of (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) save all pages in a single file, and respectively the (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#loadfromxml) and (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#loadfromfile) methods load all pages from the file.(Markdown/T_MindFusion_Diagramming_DiagramPage.md) is derived from (Markdown/T_MindFusion_Diagramming_Diagram.md) and only adds a few properties, so any code that processes (Markdown/T_MindFusion_Diagramming_Diagram.md) objects will work with (Markdown/T_MindFusion_Diagramming_DiagramPage.md) objects too. A diagram document forwards each event raised by its pages, giving you a chance to use the same handler for events raised by different pages. If a page should implement distinct user interaction or validation logic, it is also possible to attach handlers to the (Markdown/T_MindFusion_Diagramming_Diagram.md) events inherited by (Markdown/T_MindFusion_Diagramming_DiagramPage.md).
A single (Markdown/T_MindFusion_Diagramming_DiagramPage.md) could be assigned to the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#diagram) property of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md), and that lets you create your own user interface for presenting a list of pages to the user and selecting a current page.
The library includes a (Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md) that presents all pages of a document in a tabbed user interface where each tab corresponds to a page. The page displayed in the active tab is exposed by the (Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md#currentpage) property of (Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md). The active page can be changed interactively by activating its associated tab. New pages can be added and removed to / from the document through buttons in the tab strip and the pages can be rearranged by dragging their associated tabs with the mouse.
An alternative view for displaying (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) objects is the (Markdown/T_MindFusion_Diagramming_WinForms_PagedDiagramView.md). It arranges all pages vertically and lets users scroll through them, while still providing navigation buttons at the bottom for changing pages, similar to the tabbed view.
## User Interface Components
### DiagramView
(Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) renders the contents of a (Markdown/T_MindFusion_Diagramming_Diagram.md) and allows users to create new items or modify existing ones using a mouse or other pointing devices. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property defines how the control interprets user actions. Additional properties control scrolling and zooming of the view.
### TabbedDiagramView
(Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md) displays multi-page (Markdown/T_MindFusion_Diagramming_DiagramDocument.md)s. Each (Markdown/T_MindFusion_Diagramming_DiagramPage.md) is displayed in its own tab. Apart from base (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) members, the control includes properties for customizing the tab strip, and to specify whether users are allowed add or remove pages.
### Palette
The (Markdown/T_MindFusion_Diagramming_WinForms_Palette.md) control represents a tool palette that displays (Markdown/T_MindFusion_Diagramming_DiagramItem.md) objects grouped into categories. It implements (Markdown/T_MindFusion_Common_WinForms_Accordion.md) user interface that displays (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) components as its child panels, and category icon, title and collapse/expand button in pane headers. Each child (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) displays the items added to its corresponding category. Call the (Markdown/T_MindFusion_Diagramming_WinForms_Palette.md#addcategory) method to define a category and create its respective accordion pane. Call (Markdown/T_MindFusion_Diagramming_WinForms_Palette.md#additem) to add an item to specified category. The control can also be configured by populating its (Markdown/T_MindFusion_Diagramming_WinForms_Palette.md#categories) list with (Markdown/T_MindFusion_Diagramming_WinForms_PaletteCategory.md) objects. Palette provides same behavior and appearance properties as the (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) class.
### ItemListView
(Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) represents a tool palette that contains uncategorized list of diagram items. Items can be added by calling (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md#additem) method, and removed by calling (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md#removeitem). Drag-and-drop operations from (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) to (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) create a copy of the dragged item, and set its size to (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md#newinstancesize).
### Overview
(Markdown/T_MindFusion_Diagramming_WinForms_Overview.md) provides a scaled-down view of a target (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md), helping users work with larger diagrams. A tracker rectangle shows current viewport of the main (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md), and by dragging it users can change the scroll position. It can also be resized to zoom the target view.
### ZoomControl
(Markdown/T_MindFusion_Common_WinForms_ZoomControl.md) lets users change the zoom level of a target (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) by dragging a slider. It also includes arrow buttons for scrolling the view.
### Ruler
The (Markdown/T_MindFusion_Diagramming_WinForms_Ruler.md) control displays horizontal and vertical scales that let users measure and align diagram nodes.
### ShapeDesigner
(Markdown/T_MindFusion_Tools_ShapeDesignerCtrl_ShapeDesigner.md) control lets users define shape geometries. Shape definitions can be saved as a shape library XML file, loaded by application using the (Markdown/T_MindFusion_Diagramming_ShapeLibrary.md) class, and accessed by calling (Markdown/T_MindFusion_Diagramming_Shape.md#fromid) method by the (Markdown/T_MindFusion_Diagramming_Shape.md) class.
## Diagram Structure
The following topics are contained within this topic:
(#standard-item-types)
Information about the standard MindFusion.Diagramming item types, such as (Markdown/T_MindFusion_Diagramming_ShapeNode.md), (Markdown/T_MindFusion_Diagramming_TableNode.md) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md).
(#custom-item-types)
Information on how to implement and use custom item types.
(#creating-and-deleting-items)
Information on how to create and delete items both interactively and programmatically.
(#accessing-items)
Information about how to access the diagram items, how to get the selected items and how to find particular items in the diagram according to a specific criteria.
(#hosting-net-controls-in-nodes)
Information on how to host .NET controls in MindFusion.Diagramming diagrams through (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) objects.
(#attaching-and-grouping-items)
Information about the use of the (Markdown/T_MindFusion_Diagramming_Group.md) class in order to create hierarchies of dependent objects in MindFusion.Diagramming.
(#layers)
Information about how to organize items in layers and how to use the (Markdown/T_MindFusion_Diagramming_WinForms_LayerListView.md) control.
(#collapsing-and-expanding-tree-branches)
Information on how to enable expanding diagram nodes.
(#multiple-diagram-pages)
Information about the multi-page (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) class and the (Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md) control.
## Standard Item Types
Diagram elements in MindFusion.Diagramming are represented by (Markdown/T_MindFusion_Diagramming_ShapeNode.md), (Markdown/T_MindFusion_Diagramming_TableNode.md), (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md) instances. Combined and linked together, they can form complex data structures such as process or entity-relationship diagrams, class hierarchies, networks and graphs. Each of their rich features can be customized through numerous methods and properties. MindFusion.Diagramming also offers intuitive user interface for drawing and editing diagram items interactively.
### Shape Nodes
Shape nodes can represent geometric shapes, flowchart elements, icons in network diagrams, and so on. They can display both graphics and text in different fonts, sizes and colors. There are more than 100 predefined node shapes (you can preview them (#table-of-predefined-shapes)) and apart from them, MindFusion.Diagramming offers an easy way to define custom shapes. Shape nodes can be rotated, either interactively using the round selection handle drawn above them, or programmatically using the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#rotationangle) property. (Markdown/T_MindFusion_Diagramming_ShapeNode.md) appearance can be customized further using several types of custom painting. The first type gives you full control over the painting. With the second one your painting code is performed additionally to the basic painting. The third one performs standard drawing of nodes and custom drawing of their shadows.
### SVG Nodes
The (Markdown/T_MindFusion_Diagramming_SvgNode.md) class represents nodes that can display SVG drawings in addition to the rendering provided by its base (Markdown/T_MindFusion_Diagramming_ShapeNode.md) class. The SVG drawing is rendered after the associated (Markdown/T_MindFusion_Diagramming_ShapeNode.md#image) and just before the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawnode) event is raised with (Markdown/T_MindFusion_Diagramming_CustomDraw.md). The SVG drawing of the node is specified through its (Markdown/T_MindFusion_Diagramming_SvgNode.md#content) property. The SVG graphics is loaded and associated with the node through a MindFusion.Svg.SvgContent object, which should be initialized and then assigned to this property.
### Composite Nodes
Nodes in MindFusion.Diagramming can be composed from components. Components are graphical widgets similar to controls, which can be arranged in hierarchies and added to a (Markdown/T_MindFusion_Diagramming_Diagram.md) through instances of the (Markdown/T_MindFusion_Diagramming_CompositeNode.md) class. The component system contains various built-in components, such as (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md) and (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md). For a complete list of the built-in components, check (#standard-component-types). The component system can be extended with custom component classes. For more information regarding this, check (#creating-custom-components). Component hierarchies can be defined and loaded from XML. To learn more about it, refer to (#components-and-xml). The (#compositenode-tutorials) tutorial section describes various component features in step-by-step examples.
### Table Nodes
Tables can be used to represent table schemas in database diagrams or classes in class-hierarchies. A table contains cells arranged in a grid, and every cell can display text and/or image. Cells can span several rows and columns as set in the (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md#rowspan) and (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md#columnspan) properties. Cells, columns and rows can be customized in various ways - there are properties available for setting their extents, style, image and text alignment. Tables' dimensions can be programmatically changed; inserting, appending or deleting rows and columns can be done in a very comprehensive, intuitive way whenever you might need it. Tables can also display background images and graphics. The file formats supported are BMP, GIF, JPEG, ICO and WMF (the same applies for shape nodes).
### Free-form Nodes
A (Markdown/T_MindFusion_Diagramming_FreeFormNode.md) collects all points from users' mouse or touch input and displays them as node's outline. To let users draw free-form nodes interactively, set (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) to (Markdown/T_MindFusion_Diagramming_Behavior.md). Use the (Markdown/T_MindFusion_Diagramming_FreeFormNode.md#points) property of (Markdown/T_MindFusion_Diagramming_FreeFormNode.md) to get or set outline points programmatically. If the (Markdown/T_MindFusion_Diagramming_FreeFormNode.md#closed) property is set, the node is drawn as a closed shape and its interior filled, or otherwise the node is drawn as a poly-line. If the distance between first and last points drawn by user is shorter than (Markdown/T_MindFusion_Diagramming_Diagram.md#autoclosedistance), the node gets closed automatically. ### Control Hosts
A (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) can host any .NET Windows Forms control, i.e. an instance of System.Windows.Forms.Control -derived class. The hosted control could be of any of the standard .NET types such as DataGrid or Button; custom controls are supported as well. A (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) can be connected with links to any other nodes - control hosts, shapes, tables, etc.### Container Nodes
A (Markdown/T_MindFusion_Diagramming_ContainerNode.md) can contain other diagram nodes. When a container is moved, its child nodes move too. Containers can be folded to hide the contained nodes, and unfolded back to show them again. Nodes inside a container can be linked to nodes both inside and outside of it. When a container is folded, the links connected to contained nodes point to the container outlines. Containers can be nested within each other to unlimited depth.
### Paged Containers
(Markdown/T_MindFusion_Diagramming_PagedContainerNode.md) is a (Markdown/T_MindFusion_Diagramming_ContainerNode.md) subclass that organizes its child nodes into a collection of pages, represented by (Markdown/T_MindFusion_Diagramming_ContainerPage.md) objects. This allows for the creation of more orgainzed diagrams where nodes can be grouped into logical views within a single container. Only the nodes belonging to the currently active page, specified by (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md#currentpage) property, are rendered and participate in user interactions.
### TreeView Nodes
The (Markdown/T_MindFusion_Diagramming_TreeViewNode.md) class represents nodes that can display hierarchical data. The root items displayed in the node can be accessed through the (Markdown/T_MindFusion_Diagramming_TreeViewNode.md#rootitems) property. New items can be added to and removed from the returned collection. The root items can have child items on their own and so on. For more information, refer to the (Markdown/T_MindFusion_Diagramming_TreeViewItem.md) class.
### Map Nodes
The (Markdown/T_MindFusion_Diagramming_MapNode.md) class represents nodes that can render geographical maps. At this time map nodes can display the content of Esri shapefile and OpenStreetMap files. The content of a map file is represented by an instance of the (Markdown/T_MindFusion_Diagramming_MapContent.md) class that should be assigned to the (Markdown/T_MindFusion_Diagramming_MapNode.md#content) property of a (Markdown/T_MindFusion_Diagramming_MapNode.md). Esri shapefiles are loaded through (Markdown/T_MindFusion_Diagramming_MapContent.md)'s static (Markdown/T_MindFusion_Diagramming_MapContent.md#fromfile) method, and OSM files are loaded through the FromXml method.
For Esri files the color of a map region can be set via an integer index assigned to a map's Shape object, which identifies the color from (Markdown/T_MindFusion_Diagramming_MapNode.md#fillcolors) that should be used to paint the shape. When the Esri map comes with associated DBF database file, map regions can display labels if the labelField argument is specified when calling (Markdown/T_MindFusion_Diagramming_MapContent.md#fromfile) and (Markdown/T_MindFusion_Diagramming_MapNode.md#drawlabels) is enabled.
For OSM files the pens and brushes used for rendering the map are stored within internal collections, as defined by OpenStreetMap's tagging system. Additional pens and brushes for drawing and painting certain map features can be defined by using the AddPen and AddBrush methods.
### Visio Nodes
The diagram can display shapes from stencil files in Visio 2003 XML stencil format (.vsx). To load a stencil file, use an instance of the (Markdown/T_MindFusion_Diagramming_VisioStencil.md) class. The shapes are displayed in the diagram through (Markdown/T_MindFusion_Diagramming_VisioNode.md) objects. To associate a stencil shape with the node, create an instance of the (Markdown/T_MindFusion_Diagramming_VisioContent.md) class and assign it to the node's (Markdown/T_MindFusion_Diagramming_VisioNode.md#content) property. Note that standard stencils installed with Visio are copyrighted by Microsoft, and you should not use them in your application. This feature is intended to let you use public domain stencils, or commercial clipart you have purchased a license for.
### Barcode nodes
The (Markdown/T_MindFusion_Diagramming_BarcodeNode.md) class displays EAN, UPC or QR barcodes as node's content. In-place edit operations let users enter new numeric codes for 1D codes or text strings for QR codes. The barcode format is specified via the (Markdown/T_MindFusion_Diagramming_BarcodeNode.md#format) property, the encoded number or text is set via (Markdown/T_MindFusion_Diagramming_BarcodeNode.md#content), and color of 1D bars / 2D modules via (Markdown/T_MindFusion_Diagramming_BarcodeNode.md#barcolor).### Links
Links are used to represent various types of connections and relations in diagrams. MindFusion.Diagramming offers three basic link types:
- polyline links composed of straight-line segments;
- curved links composed of Bézier-spline segments;
- links composed of horizontal and vertical segments, alternating their orientation so that every segment is orthogonal to its neighbor.
A link can be connected to a node at each of the link's ends. It is also possible to have unconnected links - having one or both of their ends not connected to nodes. Some customizable link's properties are: arrowheads, style, color, text, pen width and style, modification behavior and number of segments.
## Custom Item Types
You can create your own item types by deriving the (Markdown/T_MindFusion_Diagramming_DiagramNode.md) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md) classes or their successors such as (Markdown/T_MindFusion_Diagramming_TableNode.md), (Markdown/T_MindFusion_Diagramming_ContainerNode.md) and so on. This lets you add custom data fields to the diagram items, and implement custom visualization and interaction functionality. For an example, take a look at the IconNodes sample project that comes with MindFusion.Diagramming. The IconNodes main features are outlined in the (#creating-custom-node-types) Tutorial.
### Serialization
If you add custom fields to your item class, you will probably want their values saved when saving diagram files, and restored when loading files. To enable this, override the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#saveto) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#loadfrom) methods of the (Markdown/T_MindFusion_Diagramming_DiagramItem.md) class, which let you use BinaryWriter and BinaryReader objects to implement binary serialization. For XML serialization, you must implement the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#savetoxml) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#loadfromxml) methods.
### Clipboard operations
You must implement the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#clone) method in order to enable (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#copytoclipboard) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#pastefromclipboard) to work with your custom item type, If Clone is not implemented, you will get an instance of the base class created for the pasted item, and this could lead to an exception when the base class deserialization code tries to load the item state from a data stream created by the derived class. If your class has any custom fields, it must also implement the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#saveto) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#loadfrom) methods for proper serialization.
### Rendering
If you need to provide custom rendering for your items, override the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#draw) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#drawshadow) methods. They receive as an argument an object that implements the (Markdown/T_MindFusion_Drawing_IGraphics.md) interface, which provides methods for drawing vector graphics, text and images. MindFusion.Diagramming provides (Markdown/T_MindFusion_Drawing_GdiGraphics.md), PdfGraphics and SvgGraphics implementations of that interface, which are used respectively when drawing on the screen, exporting to PDF and to SVG. That lets you use the same code regardless of where the item should draw itself.
### User interaction
To let the user draw items from a custom class, set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property of the diagram view to (Markdown/T_MindFusion_Diagramming_Behavior.md), and set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#customnodetype) or (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#customlinktype) property to the Type object that corresponds to your class. If you need to change how items handle user interaction while they are being initially created, implement the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#startcreate), (Markdown/T_MindFusion_Diagramming_DiagramItem.md#updatecreate) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#completecreate) methods. In order to change how items respond to user interaction while they are being modified, implement the StartModify, (Markdown/T_MindFusion_Diagramming_DiagramItem.md#updatemodify) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#completemodify) methods.
## Creating Custom Node Types
This section contains the necessary steps to create a custom node type.
Step 1: (#step-1-define-a-custom-node-class-)
Step 2: (#step-2-define-a-static-constructor)
Step 3: (#step-3-define-a-public-constructor-)
Step 4: (#step-4-override-the-drawlocal-method)
Step 5: (#step-5-override-the-drawshadowlocal-method)
Step 6: (#step-6-define-custom-properties)
Step 7: (#step-7-enable-serialization-)
Step 8: (#step-8-implement-serialization)
Step 9: (#step-9-enable-interactive-drawing-)
Step 10: (#step-10-add-custom-nodes-to-click-events)
## Step 1: Define a custom node class
Define the custom node class (the name IconNode is used in this tutorial) by deriving from (Markdown/T_MindFusion_Diagramming_DiagramNode.md).
```csharp
public class IconNode : DiagramNode
{
}
```
```
Public Class IconNode
Inherits DiagramNode
End Class
```
## Step 2: Define a static constructor
Define a static constructor to initialize static members of the class.
```csharp
static IconNode()
{
defaultIcon = new Bitmap(48, 48);
Graphics graphics = Graphics.FromImage(defaultIcon);
Font font = new Font("Arial", 48, FontStyle.Bold, GraphicsUnit.Pixel);
graphics.FillRectangle(Brushes.Transparent, 0, 0, 48, 48);
graphics.DrawString("?", font, Brushes.Black, 0, 0);
font.Dispose();
graphics.Dispose();
}
```
```
Shared Sub New()
defaultIcon = New Bitmap(48, 48)
Dim graphics As Graphics = graphics.FromImage(defaultIcon)
Dim font As Font = New Font("Arial", 48, FontStyle.Bold, GraphicsUnit.Pixel)
graphics.FillRectangle(Brushes.Transparent, 0, 0, 48, 48)
graphics.DrawString("?", font, Brushes.Black, 0, 0)
font.Dispose()
graphics.Dispose()
End Sub
```
## Step 3: Define a public constructor
Define a constructor to initialize the instance members.
```csharp
public IconNode(Diagram diagram) : base(diagram)
{
icon = defaultIcon;
label = "Label";
format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;
Bounds = new RectangleF(Bounds.Location, CalculateSize());
}
```
```
Sub New(ByVal diagram As Diagram)
MyBase.New(diagram)
fIcon = defaultIcon
fLabel = "Label"
format = New StringFormat
format.Alignment = StringAlignment.Center
format.LineAlignment = StringAlignment.Center
Bounds = New RectangleF(Bounds.Location, CalculateSize())
End Sub
```
## Step 4: Override the DrawLocal method
Override the (Markdown/T_MindFusion_Diagramming_ShapeNode.md#drawlocal) method of the base class to implement your own drawing logic.
```csharp
public override void DrawLocal(IGraphics graphics, RenderOptions options)
{
Rectangle iconSizePixels = new Rectangle(
0, 0, icon.Width, icon.Height);
RectangleF imageSize = MindFusion.Utilities.DeviceToDoc(
graphics, iconSizePixels);
// Draw the icon at the top-middle
graphics.DrawImage(icon,
Bounds.X + Bounds.Width / 2 - imageSize.Width / 2, Bounds.Y);
// Draw the label at the bottom
RectangleF labelBounds = RectangleF.FromLTRB(
Bounds.X, Bounds.Y + imageSize.Height,
Bounds.Right, Bounds.Bottom);
graphics.DrawString(label,
Font, Brushes.Black, labelBounds, format);
}
```
```
Public Overrides Sub DrawLocal(ByVal graphics As IGraphics, ByVal options As RenderOptions)
Dim iconSizePixels As Rectangle = New Rectangle( _
0, 0, fIcon.Width, fIcon.Height)
Dim imageSize As RectangleF = MindFusion.Utilities.DeviceToDoc( _
graphics, iconSizePixels)
' Draw the icon at the top-middle
graphics.DrawImage(fIcon, _
Bounds.X + Bounds.Width / 2 - imageSize.Width / 2, Bounds.Y)
' Draw the label at the bottom
Dim labelBounds As RectangleF = RectangleF.FromLTRB( _
Bounds.X, Bounds.Y + imageSize.Height, _
Bounds.Right, Bounds.Bottom)
graphics.DrawString(fLabel, _
Font, Brushes.Black, labelBounds, format)
End Sub
```
## Step 5: Override the DrawShadowLocal method
Override the (Markdown/T_MindFusion_Diagramming_ShapeNode.md#drawshadowlocal) method of the base class to implement custom drawing of shadows.
```csharp
public override void DrawShadowLocal(IGraphics graphics, RenderOptions options)
{
}
```
```
Public Overrides Sub DrawShadowLocal(ByVal graphics As IGraphics, ByVal options as RenderOptions)
End Sub
```
## Step 6: Define custom properties
Define custom properties. For example IconNode defines properties that specify the icon image and label.
```csharp
public Image Icon
{
get { return icon; }
set
{
icon = value;
Bounds = new RectangleF(Bounds.Location, CalculateSize());
}
}
public string Label
{
get { return label; }
set
{
label = value;
Bounds = new RectangleF(Bounds.Location, CalculateSize());
}
}
```
```
Public Property Icon() As Image
Get
Return fIcon
End Get
Set(ByVal Value As Image)
fIcon = Value
Bounds = New RectangleF(Bounds.Location, CalculateSize())
End Set
End Property
Public Property Label() As String
Get
Return fLabel
End Get
Set(ByVal Value As String)
fLabel = Value
Bounds = New RectangleF(Bounds.Location, CalculateSize())
End Set
End Property
```
## Step 7: Enable serialization
In order to enable serialization of custom item types, call the (Markdown/T_MindFusion_Diagramming_Diagram.md#registeritemclass) method. For example, to enable serialization of IconNode objects, add the following code in your form constructor.
```csharp
// Enable serialization of IconNode instances
Diagram.RegisterItemClass(typeof(IconNode), "IconNode", 1);
```
```
' Enable serialization of IconNode instances
Diagram.RegisterItemClass(GetType(IconNode), "IconNode", 1)
```
## Step 8: Implement serialization
Implement serialization of custom class members.
```csharp
protected override void SaveTo(
System.IO.BinaryWriter writer, PersistContext ctx)
{
base.SaveTo(writer, ctx);
// Save the label using the standard .NET BinaryWriter
writer.Write(label);
// Save the image using the MindFusion.Diagramming built-in image saving code,
// which stores the contents of shared images only once.
ctx.SaveImage(icon);
}
protected override void LoadFrom(
System.IO.BinaryReader reader, PersistContext ctx)
{
base.LoadFrom(reader, ctx);
label = reader.ReadString();
icon = ctx.LoadImage();
}
```
```
Protected Overrides Sub SaveTo( _
ByVal writer As System.IO.BinaryWriter, ByVal ctx As PersistContext)
MyBase.SaveTo(writer, ctx)
' Save the label using the standard .NET BinaryWriter
writer.Write(fLabel)
' Save the image using the MindFusion.Diagramming built-in image saving code,
' which stores the contents of shared images only once.
ctx.SaveImage(fIcon)
End Sub
Protected Overrides Sub LoadFrom( _
ByVal reader As System.IO.BinaryReader, ByVal ctx As PersistContext)
MyBase.LoadFrom(reader, ctx)
fLabel = reader.ReadString()
fIcon = ctx.LoadImage()
End Sub
```
## Step 9: Enable interactive drawing
To enable interactive drawing of IconNode objects, add the following code after the InitializeComponent call:
```csharp
// Let users draw IconNode objects
diagramView.CustomNodeType = typeof(IconNode);
diagramView.Behavior = Behavior.Custom;
```
```
' Let users draw IconNode objects
diagramView.CustomNodeType = GetType(IconNode)
diagramView.Behavior = Behavior.Custom
```
Setting (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#customnodetype) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) as shown above specifies that IconNode instances should be created when users draw on the diagram canvas.
## Step 10: Add custom nodes to click events
Add custom nodes programmatically in response to click events.
```csharp
private void diagram_Clicked(object sender, DiagramEventArgs e)
{
IconNode iconNode = new IconNode(diagram);
diagram.Nodes.Add(iconNode);
iconNode.Move(e.MousePosition.X, e.MousePosition.Y);
}
```
```
Private Sub diagram_Clicked(ByVal sender As Object, ByVal e As DiagramEventArgs) Handles diagram.Clicked
Dim iconNode As IconNode = New IconNode(diagram)
diagram.Nodes.Add(iconNode)
iconNode.Move(e.MousePosition.X, e.MousePosition.Y)
End Sub
```
## Creating and Deleting Items
### Creating Items Programmatically
In order to add a new node or link to a diagram, create an instance of the item class via the new operator and add it to the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#nodes) or (Markdown/T_MindFusion_Diagramming_Diagram.md#links) collection. This works the same way for adding both items from your custom class or ones from the MindFusion.Diagramming predefined types.
There are several shortcut methods provided for creating instances of the predefined node and link types. The methods are members of the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#factory) object:
- The (Markdown/T_MindFusion_Diagramming_Factory.md#createshapenode) method creates a (Markdown/T_MindFusion_Diagramming_ShapeNode.md) at the specified position.
- The (Markdown/T_MindFusion_Diagramming_Factory.md#createtablenode) method creates a (Markdown/T_MindFusion_Diagramming_TableNode.md) at a specified position. Tables have a method that connects them with other tables called (Markdown/T_MindFusion_Diagramming_TableNode.md#addrelation).
- The (Markdown/T_MindFusion_Diagramming_Factory.md#createcontainernode) method creates a (Markdown/T_MindFusion_Diagramming_ContainerNode.md) at the specified position.
- There are several overloads of the (Markdown/T_MindFusion_Diagramming_Factory.md#creatediagramlink) method that allow connecting two nodes of the same type or of different types.
### Drawing New Items
Users can draw diagram elements with the mouse. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property specifies what type of elements should be created when a user starts drawing. When a user starts drawing, an item is created and an initialization event is raised to let you customize the item appearance before showing it on the screen. The initialization events include ones such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#initializenode), (Markdown/T_MindFusion_Diagramming_DiagramBase.md#initializelink), and so on. While items are being drawn, the control raises validation events such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodecreating) to let you validate the operation and prevent creating items at a specific location. When the user releases the mouse button, the item is added to the collection that contains items from the same type (for example (Markdown/T_MindFusion_Diagramming_Diagram.md#nodes)) and an event is raised, for example (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodecreated).
### Deleting Items
Call the (Markdown/T_MindFusion_Diagramming_ItemCollectionBase.md#remove) method of the (Markdown/T_MindFusion_Diagramming_Diagram.md#nodes) or (Markdown/T_MindFusion_Diagramming_Diagram.md#links) collection to delete an item from the diagram. The (Markdown/T_MindFusion_Diagramming_Diagram.md#clearall) method clears diagram contents by deleting all items. A shortcut for removing a link between two tables is provided by the (Markdown/T_MindFusion_Diagramming_TableNode.md#breakrelation) method.
By default, deleting a node also removes its links. Set the (Markdown/T_MindFusion_Diagramming_Diagram.md#autodeletelinks) property to false to prevent that, and disconnect the links instead.
## Accessing Items
One of the most common tasks when using the component is iterating over all items in the diagram document or navigating through the connections between items - from a node to the incoming or outgoing links, or from a link to its origin and destination nodes. To enumerate items of a diagram use the (Markdown/T_MindFusion_Diagramming_Diagram.md#items), (Markdown/T_MindFusion_Diagramming_Diagram.md#links) or (Markdown/T_MindFusion_Diagramming_Diagram.md#nodes) collections. The nodes that a link connects are referenced by the link's (Markdown/T_MindFusion_Diagramming_DiagramLink.md#destination) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#origin) properties. To access the links that are connected to a node, use its (Markdown/T_MindFusion_Diagramming_DiagramNode.md#incominglinks) and (Markdown/T_MindFusion_Diagramming_DiagramNode.md#outgoinglinks) collections. The first collection contains references to all links pointing to the node, the second - to the links that start from it. Links can connect to rows of a table; to find such links use table's (Markdown/T_MindFusion_Diagramming_TableNode.md#rows) collection and the (Markdown/T_MindFusion_Diagramming_TableNode+Row.md#incominglinks) and (Markdown/T_MindFusion_Diagramming_TableNode+Row.md#outgoinglinks) collections. A shortcut for accessing the other end of a relation in entity-relationship diagrams is provided by the (Markdown/T_MindFusion_Diagramming_TableNode+Row.md#relatedonetomany) and (Markdown/T_MindFusion_Diagramming_TableNode+Row.md#relatedmanytoone) properties of the (Markdown/T_MindFusion_Diagramming_TableNode+Row.md) class.
### Selected Items
If only one item is selected, it is considered the active item and can be accessed with the (Markdown/T_MindFusion_Diagramming_Diagram.md#activeitem) property. The type of this property is (Markdown/T_MindFusion_Diagramming_DiagramItem.md); you can get the actual type of the selected item through .NET reflection. Multiple items can be selected when clicking or dragging with the CTRL key pressed at the same time. Multiple selection is represented by the (Markdown/T_MindFusion_Diagramming_Diagram.md#selection) property of the (Markdown/T_MindFusion_Diagramming_Diagram.md) class. The (Markdown/T_MindFusion_Diagramming_Selection.md) object provides collections to access the selected (Markdown/T_MindFusion_Diagramming_Selection.md#links) and (Markdown/T_MindFusion_Diagramming_Selection.md#nodes).
### Finding Items
You can search for diagram items by their (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag) or (Markdown/T_MindFusion_Diagramming_DiagramItem.md#id) using the (Markdown/T_MindFusion_Diagramming_Diagram.md#findlink), (Markdown/T_MindFusion_Diagramming_Diagram.md#findnode), (Markdown/T_MindFusion_Diagramming_Diagram.md#findlinkbyid) and (Markdown/T_MindFusion_Diagramming_Diagram.md#findnodebyid) methods. Tag and id objects are compared by calling the Equals method of the System.Object class. Thus if they are of value type, they are compared by value (that is bitwise equality). If they are of reference type their Equals method is used. If there are more items with the same tag, the first one will be returned. If no item with the specified tag or id exists, a null reference (Nothing in Visual Basic) will be returned. Groups can also be searched by tag using (Markdown/T_MindFusion_Diagramming_Diagram.md#findgroup).
### Relationship Queries
The (Markdown/T_MindFusion_Diagramming_DiagramItem.md#query) method traverses the graph by following node/link connections and group's parent/child relationships to find items in specific relation to the current one. The method receives a string argument consisting of selectors and optional predicates. The query is executed in several steps. In each step the result set is constructed from the previous result set by following the relationship specified by the current selector. If a predicate is specified after the selector identifier, the result set is filtered to include only items for which the predicate evaluates to true.
## Hosting .NET Controls in Nodes
A (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) 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.### Creating Controls Interactively
To allow end-users to draw (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) objects with the mouse, set (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) to either (Markdown/T_MindFusion_Diagramming_Behavior.md) or (Markdown/T_MindFusion_Diagramming_Behavior.md). The type of controls to be created in the host nodes is specified via the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#defaultcontroltype) property of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md). 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:
```csharp
// Draw datagrid nodes and allow connecting them with links
diagramView.Behavior = Behavior.LinkControls;
// Default type of hosted controls is DataGrid
diagramView.DefaultControlType = typeof(DataGrid);
// Mouse clicks on hosted controls are processed by MindFusion.Diagramming
diagramView.ControlMouseAction = ControlMouseAction.IgnoreControl;
```
```
' Draw datagrid nodes and allow connecting them with links
diagramView.Behavior = Behavior.LinkControls
' Default type of hosted controls is DataGrid
diagramView.DefaultControlType = GetType(DataGrid)
' Mouse clicks on hosted controls are processed by MindFusion.Diagramming
diagramView.ControlMouseAction = ControlMouseAction.IgnoreControl
```
### Creating a ControlNode Programmatically
To create a (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) programmatically, add an instance of the class to the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#nodes) collection and set its (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md#control) property to an instance of a Control-derived class. A hosted control can be replaced with another one by assigning to (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md#control) again.
### Consequences
Hosted controls are like any other child controls in a form, which leads to the following consequences:
- they participate in the form's tab order;
- they paint themselves in their own windows and are always drawn above other diagram items, independently of (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zindex);
- they paint themselves in their own windows and MindFusion.Diagramming cannot always invoke their painting code, for example when printing or rendering preview/overview windows. Handle the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#paintcontrol) in situations where controls are not rendered properly;
## Attaching and Grouping Items
MindFusion.Diagramming allows attaching a node to another diagram element, establishing a subordinate - master relationship between the two items. The easiest way to attach nodes is to call the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#attachto) method. When a master element is moved or resized, any subordinated node follows it, so that the initial distance between the two items stays constant. This happens both when a user moves the master item around, and when the item position is changed using a method or a property.
Recent versions of the API include (Markdown/T_MindFusion_Diagramming_NodeLabel_0.md) and (Markdown/T_MindFusion_Diagramming_LinkLabel.md) classes, which address several of the scenarios described below. We recommend using these classes when appropriate, as they offer a more lightweight and easily configurable alternative to attached nodes.
### Possible Uses
- Attach a (Markdown/T_MindFusion_Diagramming_ShapeNode.md#transparent) shape node to another item and set its (Markdown/T_MindFusion_Diagramming_ShapeNode.md#text), so that the shape node acts as an additional label assigned to the main item.
- Attach a shape node to another item and set the node's (Markdown/T_MindFusion_Diagramming_ShapeNode.md#image), so it acts as an additional icon displayed inside or near the main item.
- Attach a shape node or a table to another item and handle the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodeclicked) or similar events to perform some action on the main item. This makes the subordinated node act as a button or another type of UI element attached to the main item. For more complex UI requirements, use an attached (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) and handle the events raised by the control it hosts.
- In all previous cases, the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#locked) property can be set for attached nodes, which are used only as decorations embellishing the main item. That prevents users from selecting, modifying or drawing links to the subordinates.
- Attach child elements in a tree branch to the branch root, so that when a user moves a tree node, the node's children moves simultaneously with it. Modifying an item in such hierarchical group makes the modification pervade through all dependant subordinated items.
### Hierarchical Grouping
A unit of attached items is represented by an instance of the (Markdown/T_MindFusion_Diagramming_Group.md) class. To create a group, instantiate a (Markdown/T_MindFusion_Diagramming_Group.md) object and add it to the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#groups) collection, or call the (Markdown/T_MindFusion_Diagramming_Factory.md#creategroup) method passing the master object as argument. Attach items to the group using the various (Markdown/T_MindFusion_Diagramming_Group.md) methods. The (Markdown/T_MindFusion_Diagramming_DiagramNode.md#attachto) method of nodes is a shortcut to creating a group and attaching an item to it.Every member of a group can be the master item of another group, that is, an item can be subordinate in one group and meanwhile be another group's master. MindFusion.Diagramming doesn't impose any limits to the depth and width of group hierarchies built that way. However, it is not possible to put an item as a subordinate in more than one groups because the hierarchy relations would become ambiguous.
### Unions
It is possible to create such groups, that if any item in the hierarchy is modified, all other items are updated too. This can be done by putting the items in circular chain of dependencies - that is, item1 is attached to item2, item2 to item3 ... itemN to item1. If any of these items is modified, the change will propagate through the chain until it reaches its originator.
### Attaching Items to a Group
Links cannot be attached to groups but can be master items of groups. If a group's master item is a link, nodes can be attached to the control points or segments of the link. See the (Markdown/T_MindFusion_Diagramming_Group.md#attachtolinkpoint) and (Markdown/T_MindFusion_Diagramming_Group.md#attachtolinksegment) methods for details. If the master item is a node, other nodes can be attached to any of its corners, or to an area specified as percent of master-node's bounding rectangle. Check (Markdown/T_MindFusion_Diagramming_Group.md#attachtocorner) and (Markdown/T_MindFusion_Diagramming_Group.md#attachproportional) for details. A shortcut to creating (Markdown/T_MindFusion_Diagramming_Group.md) instance and calling the appropriate AttachTo* methods is provided by the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#attachto) method of the (Markdown/T_MindFusion_Diagramming_DiagramNode.md) class.
### Accessing Group Items
Group members can be accessed using the (Markdown/T_MindFusion_Diagramming_Group.md#mainitem) property and the (Markdown/T_MindFusion_Diagramming_Group.md#attachednodes) collection. To get the groups in which an item participates, use its (Markdown/T_MindFusion_Diagramming_DiagramNode.md#mastergroup) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#subordinategroup) properties.
### Destroying Groups
If a user deletes the master item of a group, the group is destroyed automatically and the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#groupdestroyed) event is raised. If (Markdown/T_MindFusion_Diagramming_Group.md#autodeleteitems) is enabled, subordinated items in the group are deleted too. If (Markdown/T_MindFusion_Diagramming_Group.md#autodeleteitems) is disabled, subordinated items are just detached from their master and remain intact. Groups can be destroyed programmatically by removing them from the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#groups) collection.
## Layers
### Layers
Items can be assigned to layers, and layers can be hidden, locked or moved up/down in the Z order as a group. (Markdown/T_MindFusion_Diagramming_Layer.md) objects provide (Markdown/T_MindFusion_Diagramming_Layer.md#visible), (Markdown/T_MindFusion_Diagramming_Layer.md#locked) and (Markdown/T_MindFusion_Diagramming_Layer.md#zindex) properties, which will affect all items in the respective layer. Layers also expose a (Markdown/T_MindFusion_Diagramming_Layer.md#title) property shown in the (Markdown/T_MindFusion_Diagramming_WinForms_LayerListView.md) control. Newly drawn items are added to the layer specified via (Markdown/T_MindFusion_Diagramming_Diagram.md#activelayer).
Set the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#layerindex) property of items to associate them with layers in the (Markdown/T_MindFusion_Diagramming_Diagram.md#layers) collection. If (Markdown/T_MindFusion_Diagramming_DiagramItem.md#layerindex) has the default value of -1, the item is not associated with any layer and its visibility depends only on the item's own (Markdown/T_MindFusion_Diagramming_DiagramItem.md#visible) property.
### Layer list control
The (Markdown/T_MindFusion_Diagramming_WinForms_LayerListView.md) control provides user interface for working with (Markdown/T_MindFusion_Diagramming_Layer.md) objects. The control presents a list of the specified (Markdown/T_MindFusion_Diagramming_WinForms_LayerListView.md#diagram)'s layers, showing their title and an overview image of the objects in each layer, and also allows editing of layer's (Markdown/T_MindFusion_Diagramming_Layer.md#visible) and (Markdown/T_MindFusion_Diagramming_Layer.md#locked) properties and choosing the Diagram's currently active layer. New layers can be added to the Diagram by clicking the + button and removed by clicking the - button.
The image below illustrates a (Markdown/T_MindFusion_Diagramming_WinForms_LayerListView.md) with several layers.
## Collapsing and Expanding Tree Branches
If a diagram represents a tree structure, the tree branch starting from a node can be collapsed or expanded again in order to hide or display hierarchy details. Use the nodes' (Markdown/T_MindFusion_Diagramming_DiagramNode.md#collapse) and (Markdown/T_MindFusion_Diagramming_DiagramNode.md#expand) methods to do this programmatically. To determine whether a subtree is expanded or collapsed, check its root's (Markdown/T_MindFusion_Diagramming_DiagramNode.md#expanded) property.### Displaying Expand/Collapse Button
If the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#expandable) property of a node is set to true, there is a [±] button displayed beside the node to allow users to collapse or expand the tree branch starting there. The button location can be customized through the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#expandbuttonposition) property. The appearance of the collapse / expand icon can be customized by setting (Markdown/T_MindFusion_Diagramming_Renderers.md#expandiconrenderer). By default, pressing that button calls automatically the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#collapse) and (Markdown/T_MindFusion_Diagramming_DiagramNode.md#expand) methods and raises the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#treeexpanded) or (Markdown/T_MindFusion_Diagramming_DiagramBase.md#treecollapsed) events.### Defining Tree Direction
A node can be connected to other nodes through outgoing and incoming links. Setting the (Markdown/T_MindFusion_Diagramming_Diagram.md#expandonincoming) property specifies which items connected to a node will be regarded as its descendants. If (Markdown/T_MindFusion_Diagramming_Diagram.md#expandonincoming) is false (default value) then each node will be regarded as a parent of its outgoing links and the items attached to them. If (Markdown/T_MindFusion_Diagramming_Diagram.md#expandonincoming) is set to true, the node's incoming links define its children. So that property specifies the direction of parent-children relationship between diagram items and respectively the overall direction in which collapsing / expanding is done.
### Expanding a Branch Recursively
Use the (Markdown/T_MindFusion_Diagramming_Diagram.md#recursiveexpand) property to specify whether the whole tree branch starting from a node will be shown when expanding, or only the first level of descendants. A related property is the (Markdown/T_MindFusion_Diagramming_Group.md#expandable) property of the (Markdown/T_MindFusion_Diagramming_Group.md) class, which specifies whether expanding and collapsing propagate through group members.
### HtmlBuilder Support
The (Markdown/T_MindFusion_Diagramming_HtmlBuilder.md) class can generate map areas for the [±] buttons displayed beside (Markdown/T_MindFusion_Diagramming_DiagramNode.md#expandable) nodes. To enable that, assign an URL to the (Markdown/T_MindFusion_Diagramming_HtmlBuilder.md#expandbtnhyperlink) property. That URL can contain some format specifiers which are automatically replaced with the values of nodes' (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag) or (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zindex) properties. That lets you identify on the server side the node whose [±] button is clicked.
### Custom Expand/Collapse Functionality
The (Markdown/T_MindFusion_Diagramming_Diagram.md#expandbuttonaction) property lets you override the standard functionality of the [±] button. Set this property to (Markdown/T_MindFusion_Diagramming_ExpandButtonAction.md) and handle the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#expandbuttonclicked) event if you need to implement your own expand/collapse logic.
## Multiple Diagram Pages
The (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) class represents a collection of diagram pages or sheets, represented by (Markdown/T_MindFusion_Diagramming_DiagramPage.md) objects. New pages can be added to the document and existing pages can be removed and reordered via the (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#pages) collection. The (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#savetoxml) and (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#savetofile) methods of (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) save all pages in a single file, and respectively the (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#loadfromxml) and (Markdown/T_MindFusion_Diagramming_DiagramDocument.md#loadfromfile) methods load all pages from the file. (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) can also load files created by the serialization methods of (Markdown/T_MindFusion_Diagramming_Diagram.md), and will show them in a single page. Note that the opposite is not true: (Markdown/T_MindFusion_Diagramming_Diagram.md) cannot load directly a (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) file.
(Markdown/T_MindFusion_Diagramming_DiagramPage.md) is derived from (Markdown/T_MindFusion_Diagramming_Diagram.md) and only adds a (Markdown/T_MindFusion_Diagramming_DiagramPage.md#title) property, so any code that processes (Markdown/T_MindFusion_Diagramming_Diagram.md) objects will work with (Markdown/T_MindFusion_Diagramming_DiagramPage.md) objects too. A diagram document forwards each event raised by its pages, giving you a chance to use the same handler for events raised by different pages. If a page should implement distinct user interaction or validation logic, it is also possible to attach handlers to the (Markdown/T_MindFusion_Diagramming_Diagram.md) events inherited by (Markdown/T_MindFusion_Diagramming_DiagramPage.md).
A (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) can be exported to PDF and Visio, and imported from Visio using the new overloads available in the (Markdown/T_MindFusion_Diagramming_Export_PdfExporter.md#export), (Markdown/T_MindFusion_Diagramming_Export_VisioExporter.md#export) and (Markdown/T_MindFusion_Diagramming_Import_VisioImporter.md#import) classes respectively. Other export classes do not support multi-page export at this time, but still can be used to export individual pages via their Export(Diagram) method.
A single (Markdown/T_MindFusion_Diagramming_DiagramPage.md) could be assigned to the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#diagram) property of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md), and that lets you create your own user interface for presenting a list of pages to the user and selecting a current page. The package also includes a (Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md) that presents all pages of a document in a tabbed user interface where each tab corresponds to a page. The page displayed in the active tab is exposed by the (Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md#currentpage) property of (Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md). The active page can be changed interactively by activating its associated tab. New pages can be added and removed to/from the document through buttons in the tab tray and the pages can be rearranged by dragging their associated tabs with the mouse.
## Components
The following topics are discussed in more details:
(#using-components)
General information on components and how to use them in diagram nodes.
(#standard-component-types)
A complete list and information about the standard MindFusion.Diagramming components, such as (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md), (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md) and (Markdown/T_MindFusion_Diagramming_Components_ShapeComponent.md).
(#components-and-xml)
How to define components hierarchies in XML and how to load those hierarchies.
(#creating-custom-components)
Information on how to implement and use custom components.
## Using Components
The components in MindFusion.Diagramming are used through an instance of the (Markdown/T_MindFusion_Diagramming_CompositeNode.md) class or a class deriving from (Markdown/T_MindFusion_Diagramming_CompositeNode.md). Simply create concrete component instances and add them to the (Markdown/T_MindFusion_Diagramming_CompositeNode.md#components) collection of the (Markdown/T_MindFusion_Diagramming_CompositeNode.md).
### Arranging Components
By default the composite node arranges its child components on top of each other, in the order they were added to the (Markdown/T_MindFusion_Diagramming_CompositeNode.md#components) collection. To apply custom arrangement, the children should be organized in a component hierarchy using the appropriate panel components. For example, to arrange children horizontally, in a row, you can use the (Markdown/T_MindFusion_Diagramming_Components_StackPanel.md) with (Markdown/T_MindFusion_Diagramming_Components_StackPanel.md#orientation) set to (Markdown/T_MindFusion_Diagramming_Components_Orientation.md). Here is an example on how to do this in code:
```csharp
CompositeNode node = new CompositeNode();
StackPanel panel = new StackPanel();
panel.Orientation = MindFusion.Diagramming.Components.Orientation.Horizontal;
panel.Spacing = 1;
TextComponent text = new TextComponent();
text.Text = "Hello world!";
panel.Components.Add(text);
ButtonComponent button = new ButtonComponent();
TextComponent buttonContent = new TextComponent();
buttonContent.Text = "Click me!";
button.Content = buttonContent;
panel.Components.Add(button);
node.Components.Add(panel);
```
```
Dim node As New CompositeNode()
Dim panel As New StackPanel()
panel.Orientation = MindFusion.Diagramming.Components.Orientation.Horizontal
panel.Spacing = 1
Dim text As New TextComponent()
text.Text = "Hello world!"
panel.Components.Add(text)
Dim button As New ButtonComponent()
Dim buttonContent As New TextComponent()
buttonContent.Text = "Click me!"
button.Content = buttonContent
panel.Components.Add(button)
node.Components.Add(panel)
```
It is possible to create custom panel classes by deriving from (Markdown/T_MindFusion_Diagramming_Components_ContentComponent.md) and overriding the (Markdown/T_MindFusion_Diagramming_Components_ContainerComponent.md#arrangecomponents) method. For an example on how to implement custom panel classes, check the (#creating-custom-components) topic.
Another way to arrange child components is by deriving from (Markdown/T_MindFusion_Diagramming_CompositeNode.md) and overriding the (Markdown/T_MindFusion_Diagramming_CompositeNode.md#arrangecomponents) method. Then, you can manually assign the position of individual nodes through their (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#bounds) property.
### Finding Components
The (Markdown/T_MindFusion_Diagramming_CompositeNode.md#findcomponent) method of the (Markdown/T_MindFusion_Diagramming_CompositeNode.md) class can be used to search for components by their (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#name). This method performs a recursive search of all components in the (Markdown/T_MindFusion_Diagramming_CompositeNode.md#components) collection and returns a reference to the first component with the specified name. This is particularly useful when the component hierarchy is defined through XML and you need to obtain a reference to a specific component in the hierarchy for additional processing. For more information on how to define components in XML check (#components-and-xml).
### Hit-testing Components
To retrieve the topmost component at a specific location, use the (Markdown/T_MindFusion_Diagramming_CompositeNode.md#getcomponentat) method of the (Markdown/T_MindFusion_Diagramming_CompositeNode.md) class. This method ignores components with any of the following properties set to false: (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#isenabled), (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#ishittestvisible).
## Standard Component Types
The following image illustrates the standard components using the default appearance settings. Additional information about the individual components can be found below.
### Border Components
The border components can adorn a single component with a border and a background. To nest a more complicated structure within a border, use one of the panel components as a parent. The border component exposes few properties. The (Markdown/T_MindFusion_Diagramming_Components_BorderComponent.md#background) and (Markdown/T_MindFusion_Diagramming_Components_BorderComponent.md#pen) can be used to define the border appearance. The derived (Markdown/T_MindFusion_Diagramming_Components_ContentComponent.md#padding) property can be used to specify the distance between the border sides and the child component. The border child can be assigned through the (Markdown/T_MindFusion_Diagramming_Components_ContentComponent.md#content) property.
### Button Components
The button components represent a clickable button. The button components, similar to the border components, can host a single child component - usually a (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md). The default button appearance is controlled through a set of brush and pen properties - (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#brush), (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#brushhovered), (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#brushpressed), (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#pen), (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#penhovered) and (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#penpressed). These properties define the appearance of the button in its different states. An alternative way to define the button appearance is through images by using the (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#imagelist) property. In addition the buttons can be custom drawn by handling the (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#customdraw) event. When a button component is clicked, the (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#clicked) event is raised.
### CheckBox Components
The check box components represent specialized buttons with an additional state - checked. The appearance of the check box in its checked state can be customized through the (Markdown/T_MindFusion_Diagramming_Components_CheckBoxComponent.md#checkedimagelist). The state can be programmatically get or set through the (Markdown/T_MindFusion_Diagramming_Components_CheckBoxComponent.md#ischecked) property.
### Text Components
Text components can display static text. Text components expose an array of properties for customizing the appearance of the displayed text, including (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md#font), (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md#textcolor), (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md#textalignment), (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md#linealignment) and (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md#background). The text of the text components can be specified through the (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md#text) property.
### Edit Components
The edit components display editable text content and are analogous to the WinForms text boxes. The following properties define the appearance of the text within the component - (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#font), (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#textcolor), (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#textwrapping). In order to edit the text in an edit component, the component has to have keyboard input. This is achieved by setting (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#isfocused) to true. The user can focus an edit component by clicking on it with the left mouse button. To enable single line edit mode set (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#acceptsreturn) to false.
The edit components expose several events, most notably - (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#textchanging) and (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#textchanged).
### Selection
The current selection of the edit component is defined through the (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#selectionstart) and (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#selectionlength) properties. The appearance of the selection is defined through the (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#selectioncolor), (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#inactiveselectioncolor) and (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md#hideselection) properties.
### Undo/Redo
The edit components implement undo and redo internally. To undo the most recent changes press CTRL+Z while the edit component has the input focus. To redo the changes, press CTRL+Y.
### Clipboard
All standard Clipboard operations are supported and can be accessed through the usual keyboard shortcuts: Copy - CTRL+C, Cut - CTRL+X, Paste - CTRL+V.
### NumericEdit Components
The numeric edit components are similar to the generic edit components. The main difference is that the numeric edits (as the name suggests) allow only numeric input. In addition to the standard edit events, the numeric edits also expose the more specialized (Markdown/T_MindFusion_Diagramming_Components_NumericEditComponent.md#validatevalue) and (Markdown/T_MindFusion_Diagramming_Components_NumericEditComponent.md#valuechanged) events. The numeric components support undo, redo and clipboard as well.
### Image Components
The image components display an image in different alignment modes. The image and alignment can be specified through the (Markdown/T_MindFusion_Diagramming_Components_ImageComponent.md#image) and (Markdown/T_MindFusion_Diagramming_Components_ImageComponent.md#imagealign) properties respectively.
### Shape Components
The shape components can display arbitrary geometrical shapes. Any shape defined through a (Markdown/T_MindFusion_Diagramming_Shape.md) object can be used, including all (#table-of-predefined-shapes). The shape components can also be initialized using the specialized geometry syntax when defined in XML. For more information regarding this, check (#components-and-xml). The appearance of the displayed shape is specified through the (Markdown/T_MindFusion_Diagramming_Components_ShapeComponent.md#brush) and (Markdown/T_MindFusion_Diagramming_Components_ShapeComponent.md#pen) properties and the shape itself is assigned through the (Markdown/T_MindFusion_Diagramming_ShapeNode.md#shape) property.
### Slider Components
The slider components provide a way to interactively select a single numeric value or a range of numeric values from within a fixed interval, by dragging one or more thumbs along a horizontal rail. In addition the slider component provides two buttons which can be used to adjust the value more precisely. The type of the slider component can be specified through the (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#type) property. The interval of available values can be set through the (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#minimum) and (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#maximum) properties. The selected values can be get or set through the (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#value), (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#startvalue) and (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#endvalue) properties respectively depending on the type of the slider. The components expose a set of events, which are raised when the slider values are changed interactively. These events are (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#batchvaluechanged), (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#endvaluechanged), (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#startvaluechanged), and (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md#valuechanged).
### Spinner Components
The spinner components represent a composition of a numeric edit box and two buttons. In addition to the core functionality provided by the numeric edit, the value can also be adjusted through the buttons or by pressing the Up, Down, PageUp and PageDown keys while the edit has the input focus. The interval in which the value can vary is specified through the (Markdown/T_MindFusion_Diagramming_Components_SpinnerComponent.md#minimum) and (Markdown/T_MindFusion_Diagramming_Components_SpinnerComponent.md#maximum) properties. The current value can be accessed through the (Markdown/T_MindFusion_Diagramming_Components_SpinnerComponent.md#value) property. The events that are raised when the value is changed are (Markdown/T_MindFusion_Diagramming_Components_SpinnerComponent.md#valuechanged) and (Markdown/T_MindFusion_Diagramming_Components_SpinnerComponent.md#batchvaluechanged).
### Simple Panels
The most basic of all three built-in panels. Simple panels arrange their child components on top of each other, in the order they were added in the (Markdown/T_MindFusion_Diagramming_Components_ContainerComponent.md#components) collection. The children are positioned within the available space according to their (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#horizontalalignment), (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#verticalalignment), (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#width) and (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#height).
### Stack Panels
Stack panels arrange their children in a vertical or horizontal row, according to the value of the (Markdown/T_MindFusion_Diagramming_Components_StackPanel.md#orientation) property.
### Grid Panels
Grid panels arrange their children in a table. The rows and columns of this table are defined through (Markdown/T_MindFusion_Diagramming_Components_GridRow.md) and (Markdown/T_MindFusion_Diagramming_Components_GridColumn.md) objects which are added to the (Markdown/T_MindFusion_Diagramming_Components_GridPanel.md#rows) and (Markdown/T_MindFusion_Diagramming_Components_GridPanel.md#columns) collection of the (Markdown/T_MindFusion_Diagramming_Components_GridPanel.md) respectively. Each grid panel needs to define at least one column and row in order to be effective. The destination row and column of individual child components depends on the value of their (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#gridrow) and (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#gridcolumn) properties.
## Components and XML
As described in the (#using-components) topic, to use components in MindFusion.Diagramming you need to instantiate them and add them to the (Markdown/T_MindFusion_Diagramming_CompositeNode.md#components) collection of a (Markdown/T_MindFusion_Diagramming_CompositeNode.md). MindFusion.Diagramming provides a more convenient method for defining component hierarchies - through XML.
### Definition
Each node in the source XML represents a component or an object. The child nodes in the XML represent child components. The XML attributes represent either property assignments or event handler attachments. A simple component hierarchy defined in XML is illustrated below:
```
```
Because the XML documents have a single root, the component hierarchies defined through XML can have a single root too. In the case when a hierarchy needs to have more than one root each root can be defined in its own XML or all the root components can be grouped under a single component container.
As is observed in the sample above the components can be specified through shortcut names. The following table lists all available shortcuts:
| **Component
** | **Shortcut Name
**
| (Markdown/T_MindFusion_Diagramming_Components_BorderComponent.md)
| Border
| (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md)
| Button
| (Markdown/T_MindFusion_Diagramming_Components_CheckBoxComponent.md)
| CheckBox
| (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md)
| Edit
| (Markdown/T_MindFusion_Diagramming_Components_ImageComponent.md)
| Image
| (Markdown/T_MindFusion_Diagramming_Components_ShapeComponent.md)
| Shape
| (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md)
| Text
| (Markdown/T_MindFusion_Diagramming_Components_NumericEditComponent.md)
| NumericEdit
| (Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md)
| Slider
| (Markdown/T_MindFusion_Diagramming_Components_SpinnerComponent.md)
| Spinner
The components can also be defined using their full names.
### Composite Properties
Some properties have too complex values and cannot be represented with attributes. Consider for example the collection properties, such as the (Markdown/T_MindFusion_Diagramming_Components_GridPanel.md#columns) and (Markdown/T_MindFusion_Diagramming_Components_GridPanel.md#rows) properties of the (Markdown/T_MindFusion_Diagramming_Components_GridPanel.md). These properties can be defined as child nodes using the specialized syntax illustrated below:
```
```
For example, to define (Markdown/T_MindFusion_Diagramming_Components_ContentComponent.md#content) of a (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md), you can use the following syntax:
```
```
### Images
Images can be defined in XML using Bitmap objects and string paths. Here is an example:
```
Images/MyImage.png
```
In the example above "Images/MyImage.png" will be interpreted as a string and the loader will attempt to create a new Bitmap instance by passing this string as an argument to the Bitmap(string) constructor.
### Shapes
The (Markdown/T_MindFusion_Diagramming_Components_ShapeComponent.md#shape) of shape components can be defined in XML by either specifying the name of a (#table-of-predefined-shapes) or by using the specialized syntax for graphical paths. The example below defines two (Markdown/T_MindFusion_Diagramming_Components_ShapeComponent.md) instances in a (Markdown/T_MindFusion_Diagramming_Components_StackPanel.md). The first shape component uses the predefined (Markdown/T_MindFusion_Diagramming_Shapes.md#ellipse) shape and the second uses a custom arrow shape:
```
```
The specialized graphical path syntax supports the following subset of operations:
| **Command
** | **Description
**
| MX,Y
| Moves to point (X, Y).
| LX,Y
| Draws a line from the current point to point (X, Y).
| CX1,Y1 X2,Y2 X3,Y3
| Draws a curve from the current point to (X3, Y3) using points (X1, Y1) and (X2, Y2) as control points.
| AW,H R A D X,Y
| Draws an arc with size (W, H) using rotation R and an end point (X, Y). A specifies whether to draw the large arc (1 - large arc, 0 - small arc) and D specifies direction - (1 - positive angle, 0 - negative).
| z
| Closes the figure.
### Event Handlers
Event handlers can be specified using attributes by setting the name of the event as the name of the attribute and the name of the handling method as attribute value. Consider the following example:
```
```
To be able to attach event handlers, the loader needs additional information. See Handling Events below.
### Loading XML
Component hierarchies defined in XML can be loaded using the (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md) class. The class provides several static (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md#load) method overloads for loading XML from different sources - string, Stream or XmlDocument. Each of the Load methods returns a (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md) representing the root of the loaded hierarchy. This component can then be added to a (Markdown/T_MindFusion_Diagramming_CompositeNode.md) or as a child of another component. The following example illustrates how to use the (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md):
```csharp
CompositeNode node = new CompositeNode();
node.Components.Add(XmlLoader.Load(@""));
```
### Handling Events
If the source XML contains definitions of event handlers you need to use one of the (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md#load) overloads, which accepts an event handler target as argument. If an event handler definition is encountered and no target is specified the loader will throw an exception. Consider the following XML:
```
```
In order to successfully load this XML, the (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md#load)(string, object) overload should be invoked passing as second argument an object, which defines an OnButtonClicked method with matching prototype.
### Resolving Types
The (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md) is capable of resolving external (non-component) types found in the source XML by performing a complete search of all currently loaded assemblies. However, this can be slow in certain scenarios. In addition certain types might not resolve properly because the loader always uses the first type that matches the specified name regardless of namespace. Luckily the (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md) provides means to manually resolve external types. In order to take advantage of this, you have to implement the (Markdown/T_MindFusion_Diagramming_Components_ITypeResolver.md) interface and pass an instance of your class to the corresponding (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md#load) overload. For any external type found, the loader will invoke the (Markdown/T_MindFusion_Diagramming_Components_ITypeResolver.md#resolvetype) method. If the method returns null (Nothing in Visual Basic) the loader will attempt to resolve the type using its default logic.
### Error Handling
It is not unusual for the (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md) to throw an exception when loading components from XML. There are many reasons for this to happen, including ill-formatted XML. Therefore it is recommended to always try and catch exceptions when loading components from XML.
## Creating Custom Components
### Custom Component
To create a custom component simply derive from any of the built-in component classes, ultimately from the (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md) class. Usually you will want to override the (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#draw) method in order to render the component and eventually the (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#getdesiredsize) method. A simple custom component is illustrated below:
```csharp
public class RectangleComponent : ComponentBase
{
protected override void Draw(MindFusion.Drawing.IGraphics graphics, RenderOptions options)
{
graphics.DrawRectangle(Pens.Red, Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height);
}
}
```
The above component only renders a red rectangle.
To provide custom component behavior based on the user input, override the (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#onmousedown), (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#onmouseup), (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#onmousemove), (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#onkeydown), (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#onkeyup) and (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#onkeypress) methods.
### Custom Panel
To create a custom container component, you need to derive from the (Markdown/T_MindFusion_Diagramming_Components_ContainerComponent.md) class and override the (Markdown/T_MindFusion_Diagramming_Components_ContainerComponent.md#arrangecomponents) method and eventually the (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#getdesiredsize) method. From within the (Markdown/T_MindFusion_Diagramming_Components_ContainerComponent.md#arrangecomponents) method you position the individual child components by assigning values to their (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#bounds) property according to their desired size and the arrangement logic of the panel. Below you can find the implementation of a very simple custom panel class, which arranges its children with a constant offset relative to each other.
```csharp
public class OffsetPanel : ContainerComponent
{
public override void ArrangeComponents(RectangleF availableSpace, MindFusion.Drawing.IGraphics graphics)
{
float y = 0;
foreach (ComponentBase component in Components)
{
// Calculate the desired size of the component
SizeF desiredSize = component.GetDesiredSize(availableSpace.Size, graphics);
component.Bounds = new RectangleF(y, y, desiredSize.Width, desiredSize.Height);
component.ArrangeComponents(component.Bounds, graphics);
y += 2;
}
}
public override SizeF GetDesiredSize(SizeF availableSize, MindFusion.Drawing.IGraphics graphics)
{
float width = 0;
float height = 0;
float y = 0;
for (int i = 0; i < Components.Count; i++)
{
ComponentBase component = Components*;
SizeF desiredSize = component.GetDesiredSize(availableSize, graphics);
width = Math.Max(width, desiredSize.Width + y);
height = Math.Max(height, desiredSize.Height + y);
y += 2;
}
return new SizeF(width, height);
}
}
```
### Using Custom Components in XML
If you want to use custom components in XML you may need to supply a custom (Markdown/T_MindFusion_Diagramming_Components_ITypeResolver.md) object to the loader. This is especially true if you want to use shortcut names for your components. Consider the above RectangleComponent in the following example:
```
```
Loading this XML will fail unless you supply an (Markdown/T_MindFusion_Diagramming_Components_ITypeResolver.md), which can resolve "Rectangle" to RectangleComponent.
## CompositeNode Tutorials
This is an older version of (#tutorial-3-create-a-custom-node-type) & 4, reconciliation WIP.
This section contains the following tutorials:
(#tutorial-1-setting-a-composite-node)
Illustrates how to create and setup a composite node - a node which can display components.
(#tutorial-2-loading-components-from-xml)
Demonstrates how to define and load components from XML as opposed to create them through code.
(#tutorial-3-custom-composite-node)
A step-by-step implementation of a custom composite node.
(#tutorial-4-handling-events-in-xml)
Demonstrates how to define event handlers in XML.
## Tutorial 1: Setting a composite node
This tutorial demonstrates how to use MindFusion.Diagramming components.
### 1. Creating a composite node
To create a composite node simply instantiate from the (Markdown/T_MindFusion_Diagramming_CompositeNode.md) class. Currently the diagram does not provide a factory method for composite node creation. Therefore you need to manually add the newly created composite node to the list of diagram nodes. The sample below references the diagram1 variable, which identifies the (Markdown/T_MindFusion_Diagramming_Diagram.md) object.
```csharp
CompositeNode node = new CompositeNode(diagram1);
node.Bounds = new RectangleF(10, 10, 60, 10);
diagram1.Nodes.Add(node);
```
```
Dim node As new CompositeNode(diagram1)
node.Bounds = New RectangleF(10, 10, 60, 10)
diagram1.Nodes.Add(node)
```
### 2. Creating the components
Now that the node is created and added to the diagram we can create its contents. For the purposes of this tutorial we will create a horizontal (Markdown/T_MindFusion_Diagramming_Components_StackPanel.md) containing a (Markdown/T_MindFusion_Diagramming_Components_TextComponent.md), an (Markdown/T_MindFusion_Diagramming_Components_EditComponent.md) and a (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md).
```csharp
StackPanel panel = new StackPanel();
panel.Orientation = MindFusion.Diagramming.Components.Orientation.Horizontal;
panel.Spacing = 1;
TextComponent text = new TextComponent();
text.Text = "Enter name:";
panel.Components.Add(text);
EditComponent edit = new EditComponent();
edit.Width = 25;
edit.AcceptsReturn = false;
panel.Components.Add(edit);
ButtonComponent button = new ButtonComponent();
TextComponent buttonContent = new TextComponent();
buttonContent.Text = "Enter";
button.Content = buttonContent;
panel.Components.Add(button);
```
```
Dim panel As New StackPanel()
panel.Orientation = MindFusion.Diagramming.Components.Orientation.Horizontal
panel.Spacing = 1
Dim text As New TextComponent()
text.Text = "Enter name:"
panel.Components.Add(text)
Dim edit As New EditComponent()
edit.Width = 25
edit.AcceptsReturn = False
panel.Components.Add(edit)
Dim button As New ButtonComponent()
Dim buttonContent As New TextComponent()
buttonContent.Text = "Enter"
button.Content = buttonContent
panel.Components.Add(button)
```
Now add the newly created components to the previously created composite node:
```csharp
node.Components.Add(panel);
```
```
node.Components.Add(panel)
```
Running the tutorial at this point should display a simple composite node the three components arranged horizontally.
To set the focus on the edit initially, simply set its (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#isfocused) property to true. Note that in order to have effect this property has to be set after the component is added to the (Markdown/T_MindFusion_Diagramming_CompositeNode.md). Disconnected components cannot receive input focus.
## Tutorial 2: Loading components from XML
In the previous tutorial ((#tutorial-1-setting-a-composite-node)) we examined how to create composite node and several components. In this example we will create a composite node with the same component structure but instead of defining the components in code we will load them from XML. Here is the XML equivalent to the component hierarchy created in the previous tutorial.
```
```
Assign the above XML to a string variable named xmlContent. Then the code that creates the composite node and loads the above XML looks like this:
```csharp
CompositeNode node = new CompositeNode(diagram1);
node.Components.Add(XmlLoader.Load(xmlContent));
node.Bounds = new RectangleF(10, 10, 60, 10);
diagram1.Nodes.Add(node);
```
```
Dim node As New CompositeNode(diagram1)
node.Components.Add(XmlLoader.Load(xmlContent))
node.Bounds = New RectangleF(10, 10, 60, 10)
diagram1.Nodes.Add(node)
```
Running the tutorial will yield the same result yet the declaration of the component hierarchy is much more compact.
## Tutorial 3: Custom composite node
In this tutorial we will create a custom (Markdown/T_MindFusion_Diagramming_CompositeNode.md) class which will be able to display information about individuals in an organization - such as name, description and image. The node will be customizable through various exposed properties.
### 1. Declaring the custom class
To create a custom composite node simply derive from the (Markdown/T_MindFusion_Diagramming_CompositeNode.md) class.
```csharp
public class OrgChartNode : CompositeNode
{
}
```
```
Public Class OrgChartNode
Inherits CompositeNode
End Class
```
Creating a custom node is applicable in various scenarios. For example, if you want to define the contents of the node in XML and want to declare event handlers for various components. Or if you want to apply custom component arrangement logic or custom rendering.
### 2. Specifying the component content
Add a single constructor to the newly created node class with the following contents:
```csharp
...
public OrgChartNode(Diagram diagram) : base(diagram)
{
string content = @"
";
Components.Add(XmlLoader.Load(content, null, null));
}
...
```
```
...
Public Sub New(ByVal diagram As Diagram)
MyBase.new(diagram)
Dim content As String = _
"" & _
"" & _
" " & _
"" & _
" " & _
" " & _
" " & _
" " & _
" " & _
" " & _
" " & _
" " & _
" " & _
"" & _
" " & _
"" & _
" " & _
" " & _
" " & _
" " & _
" " & _
" " & _
" " & _
"" & _
""
Components.Add(XmlLoader.Load(content, Nothing, Nothing))
End Sub
...
```
### 3. Declaring component fields
Now that the content of the node is defined and loaded, we will add several fields to our class referencing different components of interest. Add the following fields at the end of the class:
```csharp
private ShapeComponent shape;
private ImageComponent image;
private TextComponent title;
private TextComponent fullName;
private TextComponent text;
```
```
Private _shape As ShapeComponent
Private _image As ImageComponent
Private _title As TextComponent
Private _fullName As TextComponent
Private _text As TextComponent
```
To initialize the fields to reference the respective components, you can use the (Markdown/T_MindFusion_Diagramming_CompositeNode.md#findcomponent) method of the (Markdown/T_MindFusion_Diagramming_CompositeNode.md) class. This method will operate successfully after the components are added to the node's (Markdown/T_MindFusion_Diagramming_CompositeNode.md#components) collection. Add the following code in the constructor, after the components are connected to the composite node:
```csharp
...
Components.Add(XmlLoader.Load(content, null, null));
shape = FindComponent("Shape") as ShapeComponent;
image = FindComponent("Image") as ImageComponent;
title = FindComponent("Title") as TextComponent;
fullName = FindComponent("FullName") as TextComponent;
text = FindComponent("Text") as TextComponent;
...
```
```
...
Components.Add(XmlLoader.Load(content, Nothing, Nothing))
_shape = CType(FindComponent("Shape"), ShapeComponent)
_image = CType(FindComponent("Image"), ImageComponent)
_title = CType(FindComponent("Title"), TextComponent)
_fullName = CType(FindComponent("FullName"), TextComponent)
_text = CType(FindComponent("Text"), TextComponent)
...
```
### 4. Defining node properties
To be able to customize the node, we need to expose several properties. In this case the properties will act merely as wrappers of properties of the underlying components. For example, the Stroke property will wrap the (Markdown/T_MindFusion_Diagramming_Components_ShapeComponent.md#pen) property of the underlying (Markdown/T_MindFusion_Diagramming_Components_ShapeComponent.md) used as a background. This way we can allow the user to customize the node without exposing its internal component structure directly.
Add the following properties after the constructor.
```csharp
public MindFusion.Drawing.Pen Stroke
{
get { return shape.Pen; }
set { shape.Pen = value; }
}
public MindFusion.Drawing.Brush Fill
{
get { return shape.Brush; }
set { shape.Brush = value; }
}
public Image Image
{
get { return image.Image; }
set { image.Image = value; }
}
public string Title
{
get { return title.Text; }
set { title.Text = value; }
}
public string FullName
{
get { return fullName.Text; }
set { fullName.Text = value; }
}
public string Text
{
get { return text.Text; }
set { text.Text = value; }
}
```
```
Public Property Stroke() As MindFusion.Drawing.Pen
Get
Return _shape.Pen
End Get
Set(ByVal value As MindFusion.Drawing.Pen)
_shape.Pen = value
End Set
End Property
Public Property Fill() As MindFusion.Drawing.Brush
Get
Return _shape.Brush
End Get
Set(ByVal value As MindFusion.Drawing.Brush)
_shape.Brush = value
End Set
End Property
Public Property Image() As Image
Get
Return _image.Image
End Get
Set(ByVal value As Image)
_image.Image = value
End Set
End Property
Public Property Title() As String
Get
Return _title.Text
End Get
Set(ByVal value As String)
_title.Text = value
End Set
End Property
Public Property FullName() As String
Get
Return _fullName.Text
End Get
Set(ByVal value As String)
_fullName.Text = value
End Set
End Property
Public Property Text() As String
Get
Return _text.Text
End Get
Set(ByVal value As String)
_text.Text = value
End Set
End Property
```
### 5. Specifying default values
The default values can be provided in the constructor, after the component content have been loaded and the reference to the components of interest have been obtained. The following code sets White background and Black border as default values of new nodes.
```csharp
Stroke = new MindFusion.Drawing.Pen(Color.Black, 0);
Fill = new MindFusion.Drawing.SolidBrush(Color.White);
```
```
Stroke = New MindFusion.Drawing.Pen(Color.Black, 0)
Fill = New MindFusion.Drawing.SolidBrush(Color.White)
```
This concludes the implementation of our custom node class.
### 6. Using the custom node class
Assuming that we have a ready WinForms application containing a (Markdown/T_MindFusion_Diagramming_Diagram.md) variable named diagram1, and that two images have been added as resources to this application - named respectively Image1 and Image2, the following code creates two new instances of the OrgChartNode class and connects them with a link:
```csharp
OrgChartNode node1 = new OrgChartNode(diagram1);
node1.Bounds = new RectangleF(20, 10, 80, 40);
node1.Title = "CEO";
node1.FullName = "John Smith";
node1.Text = "Our beloved leader. \r\n" +
"The CEO of this great corporation.";
node1.Image = Properties.Resources.Image1;
diagram1.Nodes.Add(node1);
OrgChartNode node2 = new OrgChartNode(diagram1);
node2.Bounds = new RectangleF(60, 60, 80, 40);
node2.Title = "CIO";
node2.FullName = "Bob Smith";
node2.Text = "The CIO of this great corporation.";
node2.Image = Properties.Resources.Image2;
diagram1.Nodes.Add(node2);
diagram1.Factory.CreateDiagramLink(node1, node2);
```
```
Dim node1 As New OrgChartNode(diagram1)
node1.Bounds = New RectangleF(20, 10, 80, 40)
node1.Title = "CEO"
node1.FullName = "John Smith"
node1.Text = "Our beloved leader. \r\n" & _
"The CEO of this great corporation."
node1.Image = My.Resources.Image1
diagram1.Nodes.Add(node1)
Dim node2 = New OrgChartNode(diagram1)
node2.Bounds = New RectangleF(60, 60, 80, 40)
node2.Title = "CIO"
node2.FullName = "Bob Smith"
node2.Text = "The CIO of this great corporation."
node2.Image = My.Resources.Image2
diagram1.Nodes.Add(node2)
diagram1.Factory.CreateDiagramLink(node1, node2)
```
Running the application will give results similar to the image below:
## Tutorial 4: Handling events in XML
This tutorial extends the (#tutorial-3-custom-composite-node) tutorial by adding event handling to the XML component definition.
### 1. Modifying the XML definition
The first step is to modify the XML component definition from the previous example to include event handlers. For the purposes of this tutorial we will add a handler to the (Markdown/T_MindFusion_Diagramming_Components_ImageComponent.md#clicked) event of the (Markdown/T_MindFusion_Diagramming_Components_ImageComponent.md). Modify the definition of the image component in the XML as illustrated below:
```csharp
...
...
```
```
...
" " & _
...
```
Note, that in addition to the event handling we are also setting (Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md#isinteractive) to true. By default image components cannot be interacted with and if this property is not set, the event will not be raised.
### 2. Defining the event handler
Add an event handler with a matching prototype to the OrgChartNode class. If no matching method is found when the XML is loaded, the loader will throw an exception.
```csharp
private void OnImageClicked(object sender, EventArgs e)
{
MessageBox.Show("The image was clicked.");
}
```
```
Private Sub OnImageClicked(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("The image was clicked.")
End Sub
```
The above handler merely displays a message box in response to a click on the image.
### 3. Providing event handler target
The last step is to supply to the (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md) a reference to the object handling the event. In this case this is the current object, but this is not obligatory. To specify the event handler target, pass a reference as an argument to the appropriate (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md#load) method.
```csharp
Components.Add(XmlLoader.Load(content, this, null));
```
```
Components.Add(XmlLoader.Load(content, Me, Nothing))
```
Note that instead of passing null (Nothing in Visual Basic) as the second argument of the (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md#load) method we are passing a reference to the current object. If no event handler target is provided loading the XML will fail with an exception.
## User Interaction
The following topics are contained within this topic:
(#controlling-user-interaction)
Information on how to control user interactions with the control through diagram behavior, node constraints and event handling.
(#handling-events)
Information about some more notable events in MindFusion.Diagramming
(#single-and-multiple-selection)
Provides information on how to select items, how to modify the selection appearance and behavior and how to access the items that are already selected.
(#clipboard-operations)
Information on how to use the Windows clipboard with MindFusion.Diagramming.
(#scrolling-and-zooming)
Controlling scrolling and zooming in diagram views.
(#tool-tips)
Information on how to enable tooltips for individual items and for the entire diagram.
(#in-place-editing-the-contents-of-items)
Information about in-place editing of (Markdown/T_MindFusion_Diagramming_ShapeNode.md), (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md).
## Controlling User Interaction
There are several ways to control user actions on the diagram as a whole, or on individual items in the diagram.
### Disabling Interaction
By setting the Enabled property of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) to false you can make the diagram contents non-modifiable at all. Thus it will function as nothing more than a static image you can use to present some data to the user. The diagram can still be modified programmatically though.
### Drawing Modes
The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property provides several predefined sets of rules specifying how user input with the mouse/keyboard is interpreted. The default (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) is (Markdown/T_MindFusion_Diagramming_Behavior.md), where drawing with the mouse from an unoccupied point of the document is processed as a (Markdown/T_MindFusion_Diagramming_ShapeNode.md) creation request, and drawing from a node creates a (Markdown/T_MindFusion_Diagramming_DiagramLink.md). Note that such behavior leads to some extra work when creating overlaying nodes - users need to draw the second node on an empty area and move it over the first one afterwards. If you want to avoid that, use the (Markdown/T_MindFusion_Diagramming_Behavior.md) behavior instead. Additional members of the (Markdown/T_MindFusion_Diagramming_Behavior.md) enumeration provide modes for drawing different node types (e.g. (Markdown/T_MindFusion_Diagramming_Behavior.md)), and ones that allow only limited interactions, such as (Markdown/T_MindFusion_Diagramming_Behavior.md) or (Markdown/T_MindFusion_Diagramming_Behavior.md).
### Setting Diagram Bounds
Document size can be get or set with the (Markdown/T_MindFusion_Diagramming_Diagram.md#bounds) property. By default users are able to move items outside the diagram bounds. To prevent this, enable the (Markdown/T_MindFusion_Diagramming_Diagram.md#restrictitemstobounds) property. It provides three options to restrict item positions. They might not be restricted at all. The most restrictive option is to keep items entirely inside the document area. Another option allows items to be partially outside the document area but having at least a small visible part inside.
### Item Constraints
Constraints upon how users are allowed to modify a node are set through the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#constraints) and (Markdown/T_MindFusion_Diagramming_DiagramNode.md#enabledhandles) properties. The former can be used to constrain the move direction, node size and aspect ratio. The latter enables or disables specific manipulation handles of a node. That allows making the node non-moveable, non-resizable, or resizable only horizontally/vertically.
Items can be locked via the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#locked) properties. Locked items are excluded from selection and users cannot select, move or modify them.
### Control How Links Connect to Nodes
The (Markdown/T_MindFusion_Diagramming_DiagramNode.md#allowincominglinks) property of the (Markdown/T_MindFusion_Diagramming_DiagramNode.md) class lets you specify whether incoming links can be drawn to a node. The (Markdown/T_MindFusion_Diagramming_DiagramNode.md#allowoutgoinglinks) property lets you do that for outgoing links.
Anchor points define where link's ends should be placed when a user attaches a link to a node. A pattern of anchor points can be assigned to a node by setting the node's (Markdown/T_MindFusion_Diagramming_DiagramNode.md#anchorpattern). The (Markdown/T_MindFusion_Diagramming_Diagram.md#snaptoanchor) property specifies whether link ends are aligned to anchor points when creating or modifying links.
Once a link is created, a user can still move its end points to different positions, unless (Markdown/T_MindFusion_Diagramming_Diagram.md#linkendsmovable) is set to false. This can also be controlled on a per-link basis by using the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#allowmoveend) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#allowmovestart) properties. You can dynamically validate moving of links' end points using the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linkmodifying) event.
The (Markdown/T_MindFusion_Diagramming_Diagram.md#allowselfloops) property enables or disables drawing of reflexive links. They are allowed by default, but can be disabled if you consider them meaningless for the application. (Markdown/T_MindFusion_Diagramming_Diagram.md#allowlinksrepeat) controls if two nodes can be connected more than once in the same direction.
### In-place Text Editing
The text of nodes and tables can be edited in-place by double-clicking the respective items. To enable the feature set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#allowinplaceedit) property to true. For tables, both captions and cells can be edited in this way. Handle the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#celltextediting) event to enable/disable in-place editing per cell. Depending on the type of item being edited, one of these events can be fired when editing completes: (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodetextedited), (Markdown/T_MindFusion_Diagramming_DiagramBase.md#celltextedited). In-place editing mode is exited when users click outside the text entry control. Pressing ENTER or ESC exits inplace-edit mode if respectively (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#inplaceeditacceptonenter) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#inplaceeditcancelonesc) are enabled.
### Validation Events
When users try to create, delete or select an item, one of the following events is raised. To ban the action, set corresponding event bool argument to false:
| **Event
** | **Description
**
| (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodecreating)
| Raised while a user draws a new node.
| (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linkcreating)
| Raised while a user draws a new link.
| (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodeselecting)
| Raised when the user is trying to select a node.
| (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linkselecting)
| Raised when the user is trying to select a link.
| (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodedeleting)
| Raised when the user is trying to delete a node.
| (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linkdeleting)
| Raised when the user is trying to delete a link.
| (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodemodifying)
| Raised while a user modifies an existing node.
| (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linkmodifying)
| Raised while a user modifies an existing link.
For more events that can be fired by user actions, please, consult the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#diagrambase-events) section of the documentation.
### Mouse Wheel
By default, the mouse wheel scrolls the view vertically. Users can scroll horizontally by holding down the Alt modifier key while rotating the mouse wheel. The Control modifier scrolls the view in larger amounts (half the viewport width or height depending on scroll direction). Setting the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#mousewheelaction) property to (Markdown/T_MindFusion_Diagramming_MouseWheelAction_0.md) makes wheel rotation zoom into the view instead. You could implement your own mouse-wheel logic by setting (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#mousewheelaction) to (Markdown/T_MindFusion_Diagramming_MouseWheelAction_0.md) and handling the MouseWheel event.### Interaction Properties
- Setting the (Markdown/T_MindFusion_Diagramming_Diagram.md#selectaftercreate) property to true automatically selects each newly created item, so users can immediately modify it.
- (Markdown/T_MindFusion_Diagramming_Diagram.md#allowselfloops) property of (Markdown/T_MindFusion_Diagramming_Diagram.md) specifies whether users can draw reflexive / self-loop links.
- (Markdown/T_MindFusion_Diagramming_Diagram.md#allowunconnectedlinks) property specifies whether users can create links without connecting them to nodes (e.g. for simple line or curve graphics in a drawing).
- (Markdown/T_MindFusion_Diagramming_Diagram.md#allowlinksrepeat) specifies whether user can draw a second link between same pair of nodes.
- (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#delkeyaction) specifies how the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) handles the Delete key.
- The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#modifierkeyactions) property allows assigning different functions to the CTRL, ALT and SHIFT keys.
- (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#middlebuttonactions) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#rightbuttonactions) allow mapping interaction types to mouse buttons.
- (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#mousewheelaction) allows changing the function of the mouse wheel.
- (Markdown/T_MindFusion_Diagramming_DiagramNode.md#allowincominglinks) and (Markdown/T_MindFusion_Diagramming_DiagramNode.md#allowoutgoinglinks) properties of (Markdown/T_MindFusion_Diagramming_DiagramNode.md) specify if a node accepts respective types of links.
- Setting the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#locked) property of a (Markdown/T_MindFusion_Diagramming_DiagramItem.md) prevents users from interacting with it altogether.
### Multi-touch Support
The control handles touch events to implement multi-touch interactions, such as zooming, node rotation or simultaneous drawing of multiple diagram items:
- If (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#multitouchzoom) property is enabled (default), the view can be zoomed or panned using two-touch pinch / flick gestures.
- If (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#multitouchmodify) property is enabled (default), diagram nodes can be moved, scaled and rotated using two-touch pinch / flick gestures.
- If (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#multitouchzoom) property is disabled, each touch draws diagram items corresponding to current behavior.
- If (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#multitouchmodify) property is disabled, each touch started from a node draws a diagram link.
- Latter modes can be used for collaborative whiteboarding / classroom scenarios.
Built-in multi-touch can be disabled altogether by setting (Markdown/T_MindFusion_Common_WinForms_TouchControl.md#enablemultitouch) to false, e.g. if you need to handle touch events yourself or through a third-party gesture library.
## Handling Events
Most events are raised only in response to users actions. If you need to execute the same code after user actions and API calls, move the common code to a method and invoke the method both in the respective event handler and after the API method or property setter call. A notable exception is the *Deleted set of events, which are also raised when items are deleted programmatically, because in some circumstances deleting an item could delete other items related to it.
When a user starts drawing a new item with the mouse, the control raises an initialization event to let you set the appearance properties of the item. That is, for a node, the control raises (Markdown/T_MindFusion_Diagramming_DiagramBase.md#initializenode).
While the user is holding down the mouse button and drawing, a validation event is raised to let you cancel the item creation (for example, (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodecreating)). If the action is not cancelled, a creation event is raised to let your application know about the new item (for example, (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodecreated)). There are events raised when users modify items, for example, (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodemodifying) and (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodemodified). Call the CancelDrag method to cancel the item modification or creation from the *Modifying or *Creating events raised for nodes or links.
In order to repaint the screen quickly while modifying items or drawing new ones, MindFusion.Diagramming caches the representation of all items not affected by the modification in an off-screen bitmap. When the mouse is moved, the cache bitmap is blitted to the screen and only the item being modified is redrawn. If an application changes the appearance properties of items in the cache while handling a mouse movement related event, the changes won't be visualized correctly on the screen until the mouse button is released and drawing completes. Use the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#recreatecacheimage) method to recreate the cache bitmap, so that the changes in item's appearance are immediately visualized.
When a user presses the DEL key, there is a validation event raised to let you confirm that an item should be deleted (for example, (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodedeleting)), and if not cancelled, there is an item-deleted event raised (for example, (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodedeleted)).
There are many other events related to various activities a user could carry out on the diagram. The full set of events can be found here:
(Markdown/T_MindFusion_Diagramming_DiagramBase.md#diagrambase-events)
(Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#diagramview-events)
## Single and Multiple Selection
### Selecting and Modifying Items
In order to move or modify a diagram element, users drag its adjustment handles. Adjustment handles appear around an item when it is selected. Each handle can be dragged to perform specific transformation on the item. The appearance and behavior of modification handles can be altered via the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#handlesstyle) property. Depending on the value assigned to (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#modificationstart), those handles can also appear automatically when the mouse pointer hovers over an item.
### Active Item
If only one diagram item is selected, it is considered the 'active' item. One of the items in a multiple selection is also regarded as active; it is usually the one selected last. The active item has white modification handles drawn around it, while other items in multiple selection have gray handles. The active item is probably the one users are most interested in while editing a diagram, and your program can update its state and user-interface according to that. Access to the active item is provided via the (Markdown/T_MindFusion_Diagramming_Diagram.md#activeitem) property of the (Markdown/T_MindFusion_Diagramming_Diagram.md) class.
### Multiple Selection
Selection of diagram items in MindFusion.Diagramming is represented by an instance of the (Markdown/T_MindFusion_Diagramming_Selection.md) class. This class provides methods to programmatically select or deselect items and properties that specify how the selection looks and behaves. A property of the (Markdown/T_MindFusion_Diagramming_Diagram.md) class, also called (Markdown/T_MindFusion_Diagramming_Diagram.md#selection), exposes the items selected within the current document. Multiple items can be selected, thus moved at the same time. To programmatically add items to or remove them from the multiple selection invoke one of the (Markdown/T_MindFusion_Diagramming_Selection.md#additem), (Markdown/T_MindFusion_Diagramming_Selection.md#toggle) and (Markdown/T_MindFusion_Diagramming_Selection.md#removeitem) methods. The (Markdown/T_MindFusion_Diagramming_Selection.md#clear) method deselected all items and the (Markdown/T_MindFusion_Diagramming_Selection.md#change) method selects a single item, deselecting all others. Setting (Markdown/T_MindFusion_Diagramming_Selection.md#allowmultipleselection) to false disables multiple selection.
### Drawing a Selection Rectangle
To select multiple items, users must draw a selection rectangle with the left mouse button while holding down the CTRL key. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#middlebuttonactions) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#rightbuttonactions) properties let you enable drawing the selection rectangle using the middle or right mouse button.
### Appearance
The visual style of multiple selection is defined via the (Markdown/T_MindFusion_Diagramming_Selection.md#style) property of the (Markdown/T_MindFusion_Diagramming_Selection.md) class. For example, selection might be painted as a dashed rectangle or a semi-transparent filled rectangle. Colors of the selection rectangle can be changed by setting the selection's (Markdown/T_MindFusion_Diagramming_DiagramItem.md#pen) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#brush) properties. Another property related to selection visualization is the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#selectionontop), which specifies whether selected items should be painted according to their z-order position or they should be painted on top of the non-selected items.
### Enumerating Items
The (Markdown/T_MindFusion_Diagramming_Selection.md) class exposes the selected items as .NET collections. The (Markdown/T_MindFusion_Diagramming_Selection.md#items) collection references all selected items, getting them as (Markdown/T_MindFusion_Diagramming_DiagramItem.md) instances. The (Markdown/T_MindFusion_Diagramming_Selection.md#nodes) and (Markdown/T_MindFusion_Diagramming_Selection.md#links) collections keep references to the selected items of specific classes. Alternatively you might enumerate all items in the diagram and check their (Markdown/T_MindFusion_Diagramming_DiagramItem.md#selected) property.
### Automatic Selection
Setting the (Markdown/T_MindFusion_Diagramming_Diagram.md#selectaftercreate) property to true automatically selects each newly created item, so users can modify it immediately.
## Automatic Alignment
The following features help the user align items interactively.
### Alignment Grid
Items are aligned to a grid when (Markdown/T_MindFusion_Diagramming_Diagram.md#aligntogrid) is enabled. More information is available in the (#alignment-grid) topic.
### Align Nodes to Nodes
If (Markdown/T_MindFusion_Diagramming_Diagram.md#autoalignnodes) is enabled, the node currently being drawn or resized is aligned to another node so that a pair of their vertical or horizontal sides become collinear. To specify the maximal distance at which nodes are aligned, set the (Markdown/T_MindFusion_Diagramming_Diagram.md#autoaligndistance) property. The pair of aligned nodes is indicated visually by drawing an alignment guide using the pen assigned to (Markdown/T_MindFusion_Diagramming_Diagram.md#alignmentguidepen).
### Snap Links to Nearby Nodes
The currently drawn or modified link can automatically snap to the nearest border point of the nearest node when (Markdown/T_MindFusion_Diagramming_Diagram.md#autosnaplinks) is set. The maximal distance at which links will connect to a nearby node is set via (Markdown/T_MindFusion_Diagramming_Diagram.md#autosnapdistance).
## Clipboard Operations
A single diagram item or a selection of items can be copied or cut to the Windows clipboard. This is done programmatically using the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#copytoclipboard) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#cuttoclipboard) methods. To paste the clipboard contents into the current diagram call (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#pastefromclipboard).
MindFusion.Diagramming does not provide keyboard interface to clipboard operations. You might assign the standard CTRL+C, CTRL+X and CTRL+V shortcuts to menu items and handle them by calling the respective methods.
## Scrolling and Zooming
By default MindFusion.Diagramming scrollbars are visible. That can be changed by enabling or disabling the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#showscrollbars) property. When the scrollbars are visible, the position and size of their thumbs as well as the scrolling page size are automatically updated, depending on the document size, zoom factor and scroll position.
### Diagram Size
The diagram size is set through the (Markdown/T_MindFusion_Diagramming_Diagram.md#bounds) property. Its value is a RectangleF instance that specifies the origin of the diagram coordinate system and the diagram size. The scrollbar ranges also depend on the current (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomfactor). If (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#showscrollbars) is enabled, the scrollbars ranges are automatically updated when either of these properties changes.
### Automatic Scrolling
The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#autoscroll) property controls automatic scrolling. If it is enabled and the user drags an adjustment handle near the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) edges while manipulating an item, the control will scroll the viewport towards the mouse position. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#scrollzonesize) property defines the size of the area near the view borders that triggers automatic scrolling.
### Programmatic Scrolling
In order to scroll the document content programmatically, you can call the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#scrollto) method or set (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#scrollx) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#scrolly) properties. The latter can also be used to access the current scroll position in case you need it. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#bringintoview) method scrolls the viewport to ensure that a specific diagram item can be seen in the view.
### Scrolling Nodes
The contents of nodes such as (Markdown/T_MindFusion_Diagramming_ContainerNode.md), (Markdown/T_MindFusion_Diagramming_TableNode.md) and (Markdown/T_MindFusion_Diagramming_TreeViewNode.md) can be scrolled too. Set a container's (Markdown/T_MindFusion_Diagramming_ContainerNode.md#scrollable) property to allow scrolling, with (Markdown/T_MindFusion_Diagramming_ContainerNode.md#autogrow) disabled to let the container's contents overflow. If a table's (Markdown/T_MindFusion_Diagramming_TableNode.md#scrollable) property is set to true, there are up/down scroll buttons displayed in the table's caption bar. By clicking these buttons users can scroll the rows of the table. Scrolling can also be done programmatically using the (Markdown/T_MindFusion_Diagramming_TableNode.md#currentscrollrow) property. Since version 6.4.1 of the library, you can toggle tables' scroll widgets between scrollbars and scroll buttons by setting (Markdown/T_MindFusion_Diagramming_TableNode.md#scrollui).
### Zooming
Zooming is controlled via the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomfactor) property, (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomin) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomout) methods. The zoom factor is expressed as a percentage, 100% meaning no zoom. Higher than 100% makes the diagram items look closer and bigger on the screen - zooming in. Less than 100% makes items look further and smaller on screen - zooming out. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomin) method increases the zoom level by 10%, while (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomout) decreases the zoom level by 10%. To zoom and scroll the view to fit the diagram contents to the control's client area, call (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomtofit). To zoom and scroll the view so it fits a specified rectangular document area to the control's client area, call (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomtorect).
### Lasso Zoom Tool
The control supports several ways to zoom using lasso tool:
- Set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property to (Markdown/T_MindFusion_Diagramming_Behavior.md) to always draw zoom lasso.
- Set the (Markdown/T_MindFusion_Diagramming_ModifierKeyAction.md) flag for one of the keys in (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#modifierkeyactions) to let users draw zoom-lasso with respective modifier key pressed and the left mouse button.
- Assign (Markdown/T_MindFusion_Diagramming_MouseButtonActions.md) value to (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#rightbuttonactions) or (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#middlebuttonactions) property to zoom using respective mouse button.
### Magnifying
The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) provides an option for zooming in (or out) portions of the diagram through the Magnifier tool. The magnifier tool can be permanently activated by setting (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#magnifierenabled) to true. Alternatively, on-demand magnification through the right mouse button or by pressing a modifier key can be enabled be setting the appropriate value to the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#rightbuttonactions) or (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#modifierkeyactions) properties respectively.
The magnification factor can be specified through the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#magnifierfactor) property. The size of the tool and its border thickness can be set through the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#magnifierwidth), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#magnifierheight) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#magnifierframethickness) properties. The magnifier can be custom-drawn by handling the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#drawmagnifier) event.
### Panning
The diagram view can be panned by holding ALT while dragging the mouse with the left button down. Another modifier key can be used for panning by setting (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#modifierkeyactions). The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#middlebuttonactions) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#rightbuttonactions) properties let you use the middle or right mouse button to start panning. To let users pan the view with the left mouse button without using a modifier key, set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) to (Markdown/T_MindFusion_Diagramming_Behavior.md). MindFusion.Diagramming displays the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#pancursor) while panning.
## Tool-Tips
Tool-tips are short text messages displayed when the mouse pointer hovers over a diagram item for a while. To enable tool-tips, set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#showtooltips) property to true. The delay before a tool-tip appears is set via the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#tooltipdelay) property. Use the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#tooltipcontrol) property to get access to the System.Windows.Forms.ToolTip control used by MindFusion.Diagramming.
Tool-tips can be defined for each diagram element and for the whole document. If the mouse pointer stands still and it points to an item, then the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tooltip) of the item is displayed. The (Markdown/T_MindFusion_Diagramming_Diagram.md#tooltip) of the diagram appears if there is no item under the cursor or if there is an item but there isn't any tool-tip text defined for it. The anchor points assigned to nodes also provide a (Markdown/T_MindFusion_Diagramming_AnchorPoint.md#tooltip) property.
Tool-tip's text is also used as a value of the ALT attribute of image map areas corresponding to items; see (Markdown/T_MindFusion_Diagramming_HtmlBuilder.md) for more information.
## In-place Editing the Contents of Items
### Standard in-place editing
To activate the standard in-place editing of the text of MindFusion.Diagramming objects, set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#allowinplaceedit) property to true. (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#allowinplaceedit) allows in-place editing the content of a diagram element by double-clicking it. In-place editing mode can be accepted and exited by clicking anywhere outside the text-field.
If you want to change the way of accepting / rejecting changes, the following (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) properties allow using the ENTER and ESC keys to perform that: (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#inplaceeditacceptonenter) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#inplaceeditcancelonesc). When (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#inplaceeditacceptonenter) is set to true, pressing the ENTER key causes accepting changes and exiting in-place editing mode. If (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#inplaceeditacceptonenter) is set to false, pressing ENTER inserts a new line in the text while in in-place editing mode. If (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#inplaceeditcancelonesc) is set to true, pressing the ESC key performs rejecting changes and exiting in-place editing mode.
In-place editing can be applied to the following properties: (Markdown/T_MindFusion_Diagramming_ShapeNode.md#text), (Markdown/T_MindFusion_Diagramming_DiagramLink.md#text), (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md#text), (Markdown/T_MindFusion_Diagramming_TableNode.md#caption) and (Markdown/T_MindFusion_Diagramming_ContainerNode.md#caption). For tables, both captions and cells can be edited in this way.
If you want to enable/disable in-place editing of a specific table's cell, handle the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#celltextediting) event. To enable/disable in-place editing of nodes, handle the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodetextediting) event. For a (Markdown/T_MindFusion_Diagramming_DiagramLink.md) object, the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linktextediting) event is raised while in-place editing. These validation events let you prevent users from editing the text in the particular object if it is necessary.
When in-place editing of a node is completed, the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodetextedited) event is raised. For a table's cell, handle the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#celltextedited) event. (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linktextedited) event is raised when in-place editing of a (Markdown/T_MindFusion_Diagramming_DiagramLink.md) object completes.
By default, MindFusion.Diagramming creates a TextBox control to let users edit item's text. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#enterinplaceeditmode) event allows customizing the properties of that control, or attaching event handlers to it. (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#inplaceeditfont) specifies the font of the in-place edited text box. Actually, (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#inplaceeditfont) is assigned to the Font property of that text box.
When leaving in-place editing mode, the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#leaveinplaceeditmode) event is raised. This event is raised in all cases of closing the in-place editing control, for example, when the user accepts or cancels the changes made to an item's text, or when the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#endedit) method is called.
To enter in-place editing mode programmatically and let users edit an item's text inline, call the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#beginedit) method of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md). The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#endedit) method exits in-place editing mode.
### In-place editing of custom items
The (Markdown/T_MindFusion_Diagramming_InplaceEditable.md) interface allows implementing the standard in-place editing for custom defined items. By means of the methods of this interface, you can specify the position of the in-place editing textbox control and copy the entered text to a property of the edited item.
(Markdown/T_MindFusion_Diagramming_InplaceEditable.md#geteditrect) returns the destination rectangle of the in-place editing box. (Markdown/T_MindFusion_Diagramming_InplaceEditable.md#gettexttoedit) represents the initial contents of the in-place editing box. (Markdown/T_MindFusion_Diagramming_InplaceEditable.md#seteditedtext) sets the edited text to the object after completing the in-place editing.
### Using custom editor controls
Handle the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#createeditcontrol) event to create a custom in-place editor control. This event is raised if (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#allowinplaceedit) is enabled and the user double-clicks an item, or when the application invokes the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#beginedit) method of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md). When the event is raised, set its (Markdown/T_MindFusion_Diagramming_WinForms_InPlaceEditEventArgs.md#editcontrol) argument to an instance of your custom editor class. You can use any Windows Forms control as editor instead of the default TextBox. It is your responsibility to set the editor control size and position. For an example, take a look at the InteractiveTable sample project.
When the user exits in-place editing mode by clicking outside the editor, MindFusion.Diagramming raises the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#destroyeditcontrol) event. Handle it to transfer the values entered into the editor to the respective properties of the edited item, and finally destroy or hide the editor control.
## Drag and Drop
### Built-in Drag and Drop
(Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) can accept dragged shapes or nodes from (Markdown/T_MindFusion_Diagramming_WinForms_ShapeListBox.md), (Markdown/T_MindFusion_Diagramming_WinForms_ShapeToolBar.md) and (Markdown/T_MindFusion_Diagramming_WinForms_NodeListView.md) controls. To enable that, set its AllowDrop property to true. To allow dragging from (Markdown/T_MindFusion_Diagramming_WinForms_ShapeToolBar.md), set toolbar's (Markdown/T_MindFusion_Diagramming_WinForms_ShapeToolBar.md#allowdrag) property. (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) responds to (Markdown/T_MindFusion_Diagramming_Shape.md) objects dragged from (Markdown/T_MindFusion_Diagramming_WinForms_ShapeListBox.md) or (Markdown/T_MindFusion_Diagramming_WinForms_ShapeToolBar.md) by creating a (Markdown/T_MindFusion_Diagramming_ShapeNode.md) at the drop position and setting its (Markdown/T_MindFusion_Diagramming_ShapeNode.md#shape) property. Nodes dragged from (Markdown/T_MindFusion_Diagramming_WinForms_NodeListView.md) are cloned and the copies are added to the diagram.
### Custom Drop Handling
(Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) inherits standard drag-and-drop events from its base Control class. You could handle them to e.g. create nodes from dropped data, or to copy the data to existing node's fields. Note that DragEventArgs position is specified in screen coordinates, and the (Markdown/T_MindFusion_Diagramming_Diagram.md) displayed by (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) has its own coordinate system, so you will need to convert the position in two steps. First call view's PointToClient method to get the drop position as view's local pixel offset, and then call (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#clienttodoc) to get the diagram position (in (Markdown/T_MindFusion_Diagramming_Diagram.md#measureunit) and according to view's (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomfactor) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#scrollx) position). The following example demonstrates that:
```csharp
void OnDiagramViewDragDrop(object sender, DragEventArgs e)
{
var point = diagramView.ClientToDoc(
diagramView.PointToClient(new Point(e.X, e.Y)));
var node = diagram.GetNodeAt(point);
if (node == null)
{
node = diagram.Factory.CreateShapeNode(
point.X - nodeSize.Width / 2,
point.Y - nodeSize.Height / 2,
nodeSize.Width, nodeSize.Height);
}
node.Text = (string)e.Data.GetData(typeof(string));
e.Effect = DragDropEffects.Copy;
}
SizeF nodeSize = new SizeF(40, 30);
```
### Initiate Drag Operation
You can start a drag-and-drop operation from the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) by calling .NET's standard DoDragDrop method. Depending on the context from which you start dragging, you might also need to cancel view's internal user interaction handling. The following example demonstrates how to drag node's text when Shift is pressed down.
```csharp
void OnDiagramViewMouseDown(object sender, MouseEventArgs e)
{
if ((ModifierKeys & Keys.Shift) != 0)
{
var mousePosition = diagramView.ClientToDoc(e.Location);
var node = diagram.GetNodeAt(mousePosition);
if (node != null)
{
if (diagram.Interaction != null)
diagram.Interaction.CancelNow();
DoDragDrop(node.Text, DragDropEffects.Copy);
}
}
}
```
## Placement and Layout
The following topics are contained within this topic:
(#items-placement---position-size-and-z-order)
Information on how to modify the position, size and z-order of diagram items, both interactively and programmatically.
(#alignment-grid)
Information about the alignment grid.
(#lanes-grid)
Introduces the lanes grid - a grid that can be used in Swimlane diagrams or Gantt charts.
(#laying-out-diagrams-automatically)
Provides information about the automatic layouts available in MindFusion.Diagramming. These include the (Markdown/T_MindFusion_Diagramming_Layout_TreeLayout.md), (Markdown/T_MindFusion_Diagramming_Layout_SpringLayout.md) and (Markdown/T_MindFusion_Diagramming_Layout_GridLayout.md).
(#link-routing)
Information about the automatic link routing.
(#anchor-points-and-patterns)
Information on how to use anchor patterns and how to create custom anchor patterns.
## Items Placement - Position, Size and Z-order
### Measure Unit
The (Markdown/T_MindFusion_Diagramming_Diagram.md#measureunit) property specifies the unit of measure for all location and size-related values assigned to MindFusion.Diagramming properties or passed as arguments to its methods.
### Location and Size of Nodes
Use the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#bounds) property to get or change the location and size of a node. To move a node without changing its size, call the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#move) method. To change only the size of a node, invoke the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#resize) method. (Markdown/T_MindFusion_Diagramming_ShapeNode.md#resizetofitimage) and (Markdown/T_MindFusion_Diagramming_TableNode.md#resizetofitimage) methods set nodes' sizes to fit that of their pictures.
### Links Control Points
Links have two or more control points, depending on their (Markdown/T_MindFusion_Diagramming_DiagramLink.md#shape) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#segmentcount). You can get access to the control points via link's (Markdown/T_MindFusion_Diagramming_DiagramLink.md#controlpoints) collection. You must call (Markdown/T_MindFusion_Diagramming_DiagramLink.md#updatefrompoints) after moving control points of a link; that's needed in order to repaint the link and update its internal state variables. The (Markdown/T_MindFusion_Diagramming_DiagramLink.md#bounds) property is read-only. It returns the smallest rectangle that bounds all link points.
### Link Dynamics
The (Markdown/T_MindFusion_Diagramming_DiagramLink.md#dynamic) property of a link can be enabled to make the link automatically recalculate its end point positions if the nodes connected to the link are moved or resized; the end points are moved in such a way that the link points to the centers of the connected nodes. A related property is (Markdown/T_MindFusion_Diagramming_DiagramLink.md#autosnaptonode), which can be enabled to make the link end points align to the border of their origin or destination nodes while a user move the link ends.
(Markdown/T_MindFusion_Diagramming_DiagramLink.md#retainform) is useful for links that have more than two control points. If the nodes that a link connects are moved around, usually only the segments at the ends of that link are updated, so that they stay connected to their respective nodes. In that case all intermediate control points stay where they are. However, if (Markdown/T_MindFusion_Diagramming_DiagramLink.md#retainform) is enabled, all control points will move simultaneously in a way they preserve their relative position to each other, and thus preserving the overall form of the link.
Links have an (Markdown/T_MindFusion_Diagramming_DiagramLink.md#autoroute) property that enables or disables automatic routing of a link. Routed links avoid nodes by finding the shortest path between their origin and destination that does not cross any other nodes. The link routing algorithm can be tuned via the properties exposed by (Markdown/T_MindFusion_Diagramming_RoutingOptions.md).
### Interactive Moving or Resizing
End-users of your application can move or resize the diagram elements. They do this by selecting an item and dragging any of its adjustment handles, a point inside its interior, any of its sides or a selection frame. The (Markdown/T_MindFusion_Diagramming_DiagramNode.md#handlesstyle) property of nodes controls how interaction can be performed. Additionally it defines the representation of selected items on screen. (Markdown/T_MindFusion_Diagramming_DiagramNode.md#enabledhandles) lets you disable specific manipulations users are allowed to perform on a node, for example resizing the item horizontally or moving it. If an item is modified interactively, the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodemodified) or (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linkmodified) event is raised, depending on the item's type.
### Controlling the Z-order
The Z-order defines how items are ordered along the Z-axis, so that one item appears in front of or behind another one. Members of the (Markdown/T_MindFusion_Diagramming_DiagramItem.md) class give you full control over the Z-order. To move an item one level up or down, invoke the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zlevelup) or (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zleveldown) methods. To move an item to the bottom of the Z-order call its (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zbottom) method. To move the item in front of all others, call its (Markdown/T_MindFusion_Diagramming_DiagramItem.md#ztop) method. You can use the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zindex) property to get or set the position of an item within the Z-order.
## Alignment Grid
MindFusion.Diagramming provides an alignment grid to help users place the diagram items more precisely. To activate the grid, set the (Markdown/T_MindFusion_Diagramming_Diagram.md#aligntogrid) property to true. If the grid is active while an item is being created or modified, the item's control-points are aligned to the nearest grid points. The distance between adjacent grid points is set by the (Markdown/T_MindFusion_Diagramming_Diagram.md#gridsizex) and (Markdown/T_MindFusion_Diagramming_Diagram.md#gridsizey) properties. The (Markdown/T_MindFusion_Diagramming_Diagram.md#gridoffsetx) and (Markdown/T_MindFusion_Diagramming_Diagram.md#gridoffsety) properties allow specifying the horizontal and vertical offset of the first point in the alignment grid.
Items created or modified by a user are automatically aligned to the grid. However, if items are placed in the diagram programmatically, their coordinates are set to the specified positions without aligning. In such cases use (Markdown/T_MindFusion_Diagramming_Diagram.md#alignpointtogrid) if items must be placed exactly at grid points.
The grid can be either visible or invisible, depending on whether the (Markdown/T_MindFusion_Diagramming_Diagram.md#showgrid) value is true or false. If visible, the grid is painted as a matrix of points or as series of crossing lines, as specified by the (Markdown/T_MindFusion_Diagramming_Diagram.md#gridstyle) property. (Markdown/T_MindFusion_Diagramming_Diagram.md#gridcolor) defines the color with which the alignment points or lines are painted.
## Lanes Grid
The classes from the (#mindfusiondiagramminglanes) namespace let you develop process maps and lane diagrams, useful in business process planning and reporting. Processes consist of consecutive operations accomplished by people involved, technical installations, means of contact, and flow of information. The MindFusion.Diagramming lane grid features allow indicating and arranging related diagram items in complicated processes and systems, that is, Swim lane diagrams (known as Rummler-Brache diagram), Gantt Charts (planning and scheduling of projects). A lane in the grid can visually contain nodes, links, shapes or images, that represent tasks fulfilled in specified periods of time by people, companies or departments.
The (#mindfusiondiagramminglanes) namespace provides the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md), (Markdown/T_MindFusion_Diagramming_Lanes_Header.md), (Markdown/T_MindFusion_Diagramming_Lanes_HeaderCollection.md) and (Markdown/T_MindFusion_Diagramming_Lanes_Style.md) classes, the (Markdown/T_MindFusion_Diagramming_Lanes_ICell.md) interface and the (Markdown/T_MindFusion_Diagramming_Lanes_ResizeType.md) enumeration. These types expose additional properties and methods that let you define your own grids as required by your application logic. Grids can include varying number of lanes, divided into child rows and columns whose intersections form cells. The cells color and style can be customized too.
Use the (Markdown/T_MindFusion_Diagramming_Diagram.md#enablelanes) property of the (Markdown/T_MindFusion_Diagramming_Diagram.md) class to display lanes in your application. The (Markdown/T_MindFusion_Diagramming_Diagram.md#lanegrid) lets you setup the rows and columns in the grid by defining horizontal and vertical lanes, where each lane can be titled by its own header and/or subheadings. The grid can be resized by setting the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#columncount) and (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#rowcount) properties or by adding headers to the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#columnheaders) and (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#rowheaders) collections. A column or row can be divided into child elements by adding to the (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#subheaders) collection of a (Markdown/T_MindFusion_Diagramming_Lanes_Header.md), which lets you form a complex hierarchy of unlimited depth. The intersection of rows and columns can be either a simple cell for bottommost elements in the hierarchy, or a group of cells for parent rows and columns. Cells or cell groups can be accessed via the grid class (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#item) property, that lets you index cells either by their integer positions, or by their (Markdown/T_MindFusion_Diagramming_Lanes_Header.md) objects.
If the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#allowresizeheaders) property of the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md) class is enabled, users can resize the grid columns and rows as desired. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#lanecolumnresizecursor) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#lanerowresizecursor) properties get or set the mouse cursor shown when resizing the lane column header or the lane row header. The (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#cellboundschanged) event is raised when a cell is resized. An application can handle this event in order to rearrange or resize nodes so that they stay within a specific column or row of the grid.
The position of the grid and grid headers within the diagram is defined via (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#topmargin) and (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#leftmargin), which specify the grid offset relative to (Markdown/T_MindFusion_Diagramming_Diagram.md#bounds). (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#hookheaders) enables lane headers to be anchored to the left or right side of the control's visible area. The sizes of headers at different levels in the lane hierarchy can be set in a single operation by the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#rowheaderswidths) and (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#columnheadersheights) properties.
The appearance of the lanes grid can be customized further via the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#aligncells) property, which specifies whether cells are aligned to each other, the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#headersontop) poperty, which specifies whether headers should appear on top of the Z-order, and the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#topleftareastyle) specifying the appearance of the grid's top-left corner.
The (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md) class provides many miscellaneous methods that can be used to find grid elements, for determining their bounds and for hit-testing: (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#findcolumn), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#findrow), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getcellbounds), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getcellcolumn), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getcellfrompoint), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getcellrow), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getcolumn), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getrow), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getrowindex), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getcolumnheaderbounds), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getcolumnindex), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getheaderbounds), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getrowheaderbounds), (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#getheaderfrompoint).
The headers in the lanes grid can be customized by using the following properties of the (Markdown/T_MindFusion_Diagramming_Lanes_Header.md) class:
| **Property Name
** | **Description
**
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#height)
| Gets or sets the height of the header and the related row in the grid.
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#resizetype)
| Gets or sets the resize type of the header.
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#rotatetitle)
| Gets or sets a value indicating whether rotating of the header caption at 90 degree is enabled.
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#style)
| Gets or sets the style of the header.
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#subheaders)
| Gets a collection with the subheaders of the header.
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#title)
| Gets or sets the header caption.
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#titlecolor)
| Gets or sets the color of the header caption.
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#titlefont)
| Gets or sets the font of the header caption.
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#titleformat)
| Gets or sets the alignment format of the header.
| (Markdown/T_MindFusion_Diagramming_Lanes_Header.md#width)
| Gets or sets the width of the header and the related column in the grid.
## Laying Out Diagrams Automatically
Applications that process hierarchical or more complex entity-relationship data might need to present that data to end-users in an aesthetical and visually appealing manner. Such applications would store their data as graph of connected nodes possibly having additional information attached to them. However, position and size coordinates of nodes might be unnecessary and/or unavailable. MindFusion.Diagramming provides a way to automatically arrange the nodes of a diagram, applying attractive layouts on the overall structure of the diagram. To utilize that functionality, an application can create a diagram by assigning generic coordinates to its nodes, instantiating a layout object and invoking the layout's (Markdown/T_MindFusion_Diagramming_Layout_Layout.md#arrange) method. Non-blocking (Markdown/T_MindFusion_Diagramming_Layout_Layout.md#arrangeasync) method is available in the .NET 4.5 build of diagramming.dll assembly. Arrange methods can be prevented from changing positions of individual items by setting the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#ignorelayout) property of those items to true.
The classes that implement automatic layout algorithms are located in the (#mindfusiondiagramminglayout) namespace. The following sections list the available algorithms categorized by their general implementation strategy: (#force-directed-layout-algorithms), (#topology-based-layout-algorithms) and (#semantics-based-layout-algorithms).
## Force-directed layout algorithms
Force-directed algorithms simulate forces acting between objects in the graph and iteratively run a physical simulation that pulls the objects closer or pushes them apart. At each iteration the energy associated with the simulated system decreases, and the node positions calculated by this process usually lead to evenly distributed nodes and uniform link lengths.
### Spring-Embedder Graph Layout
Spring-Embedder is force-directed layout algorithm. It simulates a physical system in which nodes repulse each other, and the links between them act as confining springs. Graphs processed by Spring-Embedder have their nodes distributed uniformly across the diagram area. The algorithm can be applied on a graph by creating a (Markdown/T_MindFusion_Diagramming_Layout_SpringLayout.md) object and calling its (Markdown/T_MindFusion_Diagramming_Layout_Layout.md#arrange) method. Members of (Markdown/T_MindFusion_Diagramming_Layout_SpringLayout.md#springlayout-members) allow you to set the desired distance between graph nodes and the number of iteration steps to use while calculating node positions. You can also specify to minimize link crossings. If you select that option, the algorithm would produce better result with more iteration steps. However, it needs more time to complete if more steps are specified. In VB.NET and C#, Spring-Embedder layout might be applied like this:
```csharp
using MindFusion.Diagramming;
using MindFusion.Diagramming.Layout;
...
private void button1_Click(object sender, EventArgs e)
{
SpringLayout sl = new SpringLayout();
sl.IterationCount = 500;
sl.NodeDistance = 30;
sl.Arrange(diagram);
}
```
```
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sl As New SpringLayout()
sl.IterationCount = 500
sl.NodeDistance = 30
sl.Arrange(diagram)
End Sub
```
### Grid Graph Layout
The (Markdown/T_MindFusion_Diagramming_Layout_GridLayout.md) algorithm arranges diagram nodes in a grid, keeping connected nodes close together. The algorithm strives to achieve a small number of link crossings. It is based on an iterative process whose initial steps shuffle the grid nodes randomly. That can lead to very different results each time the algorithm is run.
To apply the layout to a diagram, create a (Markdown/T_MindFusion_Diagramming_Layout_GridLayout.md) instance, set its members and invoke the (Markdown/T_MindFusion_Diagramming_Layout_Layout.md#arrange) method. Grid layout might be applied like this:
```csharp
using MindFusion.Diagramming;
using MindFusion.Diagramming.Layout;
...
private void button1_Click(object sender, EventArgs e)
{
GridLayout gl = new GridLayout();
gl.GridSize = 75;
gl.Arrange(diagram);
}
```
```
Imports MindFusion.Diagramming
Imports MindFusion.Diagramming.Layout
...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim gl As New GridLayout()
gl.GridSize = 75
gl.Arrange(diagram)
End Sub
```
### Simulated Annealing Graph Layout
The (Markdown/T_MindFusion_Diagramming_Layout_AnnealLayout.md) class implements the Simulated Annealing graph layout algorithm. Simulated Annealing is a general-purpose optimization method used to solve large-scale combinatorial problems by simulating the process of heating and cooling of metal to achieve freedom from defects. Finding a nice arrangement of a graph is a combinatorial problem that can be reduced to assigning costs to graph configurations and finding the minimum cost configuration. (Markdown/T_MindFusion_Diagramming_Layout_AnnealLayout.md) assigns costs to graph configurations by evaluating different aesthetic criteria such as distance between nodes, length of links and the number of link crossings. Thus the best configuration found will have good aesthetic properties.
### Circular Graph Layout
(Markdown/T_MindFusion_Diagramming_Layout_CircularLayout.md) distributes nodes evenly on the circumference of a circle at positions that result in as few link crossing as possible. Set its (Markdown/T_MindFusion_Diagramming_Layout_CircularLayout.md#radius) property to specify the size of the layout circle. Use (Markdown/T_MindFusion_Diagramming_Layout_CircularLayout.md#siftingrounds) to set the number of fine-tuning crossing-reduction iterations.
## Topology based layout algorithms
The following algorithms are based on the topological features of the graph being arranged, such as the size and adjacency of faces (a face is a region bounded by links) and the overall direction of links. The algorithms differ in the shape they apply to graph faces and the manner in which faces are embedded in the plane.
### One-way Graph Layout
The (Markdown/T_MindFusion_Diagramming_Layout_OneWayLayout.md) class ensures that links enter into nodes from the same general direction and exit them from the opposite side. If the graph contains cycles, some links bend around the nodes to keep the enter/exit direction consistent. The algorithm aims to minimize the number of such links.
### Orthogonal Graph Layout
The (Markdown/CC_T_MindFusion_Diagramming_Layout_OrthogonalLayout_0.md) class implements an orthogonal graph layout algorithm. Each link is drawn as a chain of alternating horizontal and vertical segments. Nodes are placed in a way that facilitates few links bends and crossings. This algorithm was designed for planar graphs where the nodes have at most four incident links, and produces best results with such graphs as input. It can arrange any arbitrary graph as well, by adding some dummy nodes and links to planarize the graph and reduce its vertex degree, and removing them after the layout. However this might lead to using larger area than necessary, due to the space occupied by dummy elements.
### Orthogonal Router
(Markdown/T_MindFusion_Diagramming_Layout_OrthogonalRouter.md) is a secondary layout algorithm that can be used to arrange links after an initial node arrangement has already been applied. The orthogonal layout is useful when there are much more links than nodes in a graph. The algorithm strives to achieve the following criteria, while preserving as much of the initial node configuration as possible.
- links must not overlap;
- only vertical and horizontal routing lines are used;
- graph routing is performed with respect to the specified main layout direction;
- links crossings are minimized;
- bends are minimized;
### Topological Layout
(Markdown/T_MindFusion_Diagramming_Layout_TopologicalLayout.md) applies graph topological ordering to the diagram (topological ordering of a graph is one where link's origin node is placed before link's destination node). The layout algorithm arranges nodes in a row or a column, depending on the value of the (Markdown/T_MindFusion_Diagramming_Layout_TopologicalLayout.md#orientation) property, in such a way that there are no backward links when the graph is acyclic. If the graph contains cycles, the algorithms selects ordering with as few backward links as possible. Links that connect non-adjacent nodes are rendered as arcs, whose amplitude is proportional to the distance between respective connected nodes. Forward links are rendered at one side of the nodes and back links are rendered at the opposite side. All that makes it easy to discern graph features such as overall flow direction, cycles and nested cycles.
### Cascade Graph Layout
(Markdown/T_MindFusion_Diagramming_Layout_CascadeLayout.md) places nodes on a virtual grid and arranges links orthogonally, such that if the source graph is planar all links are guaranteed to have no more than two bends and will not intersect. By default the layout method arranges nodes in rows and link segments in columns; this can be changed by setting the (Markdown/T_MindFusion_Diagramming_Layout_CascadeLayout.md#orientation) property.
### Triangular Graph Layout
(Markdown/T_MindFusion_Diagramming_Layout_TriangularLayout.md) places nodes on a virtual grid, such that if the source graph is planar, all links are guaranteed to have a single segment and not intersect. If the graph is not planar, its intersecting links can be optionally segmented and bended in order to improve readability. The layout method places the nodes from the external face on a triangle and recursively adds the rest of the nodes as vertices of internal triangles. As a result, it is very effective for near maximal-planar (a.k.a. triangular) graphs.
## Semantics based layout algorithms
The following algorithms arrange the diagram in a way that shows the semantics of individual items or the overall graph structure, such as hierarchical relations between objects, loops and decisions in flowcharts, assignments of nodes to layers or swimlanes.
### Tree Layout
If application's data is structured hierarchically, it is appropriate to apply tree layout on it. To do this, create a (Markdown/T_MindFusion_Diagramming_Layout_TreeLayout.md) object and call its (Markdown/T_MindFusion_Diagramming_Layout_Layout.md#arrange) method. Members of (Markdown/T_MindFusion_Diagramming_Layout_TreeLayout.md) control many aspects of the layout process. The type of layout can be directional or radial. You can choose how much space to leave between tree levels and between nodes on the same level. For directional layouts the style of links in the arranged tree can be set to straight, orthogonal or curved. Global tree direction and alignment can be customized too. In VB.NET and C#, tree layout might be applied like this:
```csharp
using MindFusion.Diagramming;
using MindFusion.Diagramming.Layout;
...
private void button1_Click(object sender, EventArgs e)
{
TreeLayout tl = new TreeLayout();
tl.Type = TreeLayoutType.Cascading;
tl.Direction = TreeLayoutDirections.LeftToRight;
tl.LinkStyle = TreeLayoutLinkType.Cascading2;
tl.LevelDistance = 10;
tl.Arrange(diagram);
}
```
```
Imports MindFusion.Diagramming
Imports MindFusion.Diagramming.Layout
...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tl As New TreeLayout()
tl.Type = TreeLayoutType.Cascading
tl.Direction = TreeLayoutDirections.LeftToRight
tl.LinkStyle = TreeLayoutLinkType.Cascading2
tl.LevelDistance = 10
tl.Arrange(diagram)
End Sub
```
### Fractal Tree Layout
(Markdown/T_MindFusion_Diagramming_Layout_FractalLayout.md) is a tree layout algorithm that places child nodes symmetrically around their parent node. Nodes at the lowest level are arranged directly in a circle around their parent. At the upper level, the already arranged nodes form branches that are arranged in a circle around the new parent node. The algorithm is recursively repeated till the highest level is reached. If nodes in the tree have uniform number of children, the end result has fractal-like appearance (subsets of the graph look like scaled-down copies of the whole graph).
You can choose which node should be displayed at the center of the topmost circle by setting the (Markdown/T_MindFusion_Diagramming_Layout_FractalLayout.md#root) property. If it is not specified, the algorithm automatically selects a root that leads to more balanced distribution of nodes.
### Layered Graph Layout
The (Markdown/T_MindFusion_Diagramming_Layout_LayeredLayout.md) algorithm arranges diagram nodes in layers according to several criteria, most important of which are: connected nodes must be placed close together; links must flow in one direction if possible; links must cross as few layers as possible; links must not cross other links. To apply the layout to a diagram, create a (Markdown/T_MindFusion_Diagramming_Layout_LayeredLayout.md) instance, set its members and invoke the (Markdown/T_MindFusion_Diagramming_Layout_Layout.md#arrange) method. In C# and VB.NET, layered layout can be applied like this:
```csharp
using MindFusion.Diagramming;
using MindFusion.Diagramming.Layout;
...
private void btnArrange_Click(object sender, System.EventArgs e)
{
LayeredLayout ll = new LayeredLayout();
ll.Orientation = MindFusion.Diagramming.Layout.Orientation.Horizontal;
ll.SplitLayers = true;
ll.LayerDistance = 35;
ll.Arrange(diagram);
}
```
```
Imports MindFusion.Diagramming
Imports MindFusion.Diagramming.Layout
...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ll = New LayeredLayout()
ll.Orientation = MindFusion.Diagramming.Layout.Orientation.Horizontal
ll.SplitLayers = True
ll.LayerDistance = 35
ll.Arrange(Diagram)
End Sub
```
### Tree map layout
Tree maps represent hierarchies by nesting child nodes within their parents, where the areas of leaf nodes are proportional to their (Markdown/T_MindFusion_Diagramming_DiagramItem.md#weight) values. Unlike other layout algorithms, (Markdown/T_MindFusion_Diagramming_Layout_TreeMapLayout.md) expects hierarchies to be defined via grouping or containment (see (Markdown/T_MindFusion_Diagramming_DiagramNode.md#attachto) method and (Markdown/T_MindFusion_Diagramming_ContainerNode.md) class), and will ignore any links in the diagram. The diagram area covered by the topmost nodes in a hierarchy is specified via the (Markdown/T_MindFusion_Diagramming_Layout_TreeMapLayout.md#layoutarea) property. By default, the layout tries to keep the ratio of node sides as close as possible to one. However this could make it hard to distinguish separate levels of the hierarchy. To alleviate that, set (Markdown/T_MindFusion_Diagramming_Layout_TreeMapLayout.md#squarify) to false, and child nodes will be arranged either as a row or a column inside their parent node, alternating directions for each level. The drawback is that when (Markdown/T_MindFusion_Diagramming_DiagramItem.md#weight) ratios differ greatly or nodes contain many children, some nodes could end up with very narrow rectangles.
### Decision flowchart layout
(Markdown/T_MindFusion_Diagramming_Layout_DecisionLayout.md) arranges simple flowcharts consisting of decision boxes with up to three outgoing links per node and activity boxes with a single outgoing link per node. The nodes are arranged in columns and rows, whose distance depends on the (Markdown/T_MindFusion_Diagramming_Layout_DecisionLayout.md#horizontalpadding) and (Markdown/T_MindFusion_Diagramming_Layout_DecisionLayout.md#verticalpadding) property values. When links share the same row or column, they are placed at a distance specified via (Markdown/T_MindFusion_Diagramming_Layout_DecisionLayout.md#linkpadding). The layout arranges nodes recursively starting from (Markdown/T_MindFusion_Diagramming_Layout_DecisionLayout.md#startnode). If (Markdown/T_MindFusion_Diagramming_Layout_DecisionLayout.md#startnode) is not specified, the algorithm selects the root of the deepest branch of the graph's spanning tree as start node.
### Flowchart Graph Layout
(Markdown/T_MindFusion_Diagramming_Layout_FlowchartLayout.md) recognizes program code -like patterns in the graph, such as loops, sequences and if/switch branchings, and arranges them recursively. (Markdown/T_MindFusion_Diagramming_Layout_FlowchartLayout.md) could be used to arrange other types of graphs as well, though with some restrictions. For example it treats all back links as loops in the code, and expects that they are nested - loop links starting closer to the stop node should end closer to the start node. Another similar restriction is that there shouldn't be any cross-links that connect different branches of a decision sub-graph.
### Workflow Graph Layout
The (Markdown/T_MindFusion_Diagramming_Layout_FlowLayout.md) algorithm can be used to lay out flowcharts, workflow and process diagrams. It works by applying a customizable set of rules for local positioning of connected nodes relatively to each other. On a larger scale, the algorithm keeps groups of nodes separate and prevents links between the groups from crossing nodes. The FlowLayout and ProcessLayout examples included in the MindFusion.Diagramming package demonstrate two sample sets of layout rules.
### Swimlane Layout
(Markdown/T_MindFusion_Diagramming_Layout_SwimlaneLayout.md) can be used to arrange process diagrams in which nodes representing activities are placed in swimlanes representing resources. The index of the resource allocated to an activity should be assigned to the corresponding node's (Markdown/T_MindFusion_Diagramming_DiagramItem.md#layouttraits)[(Markdown/T_MindFusion_Layout_SwimlaneLayoutTraits.md)].
By default, the algorithm works with the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#lanegrid), but its (Markdown/T_MindFusion_Diagramming_Layout_SwimlaneLayout.md#swimlanegrid) property can be set to any class that implements (Markdown/T_MindFusion_Diagramming_Layout_ISwimlaneGrid.md). This allows applying the layout to a custom-drawn grid rendered through the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawbackground) event, or one composed of locked background nodes.
### Hierarchical Graph Layout
(Markdown/T_MindFusion_Diagramming_Layout_HierarchicalLayout.md) places nodes on user-defined levels, such that if the source graph is level-planar, all links are guaranteed to have a single segment and not intersect. The layout method requires that for each node (Markdown/T_MindFusion_Diagramming_DiagramItem.md#layouttraits) contains a (Markdown/CC_T_MindFusion_Layout_HierarchicalLayoutTraits_1.md) entry specifying the level, and no two connected nodes must be on the same level.
## Multi-level layout algorithms
Multi-level algorithms are used to arrange very large graphs quickly by running other layout algorithms on small parts of the original diagram. Since layout algorithms are usually of polynomial complexity, applying them on smaller subgraphs considerably reduces the overall running time. Multi-level algorithms typically construct a virtual graph that is coarse representation of the diagram, where each virtual node represents a set of actual nodes and links between them. Each set is arranged independently from the others, then the virtual graph is arranged too and the actual sets are placed at the positions of the virtual nodes.
### Composite Graph Layout
## Link Routing
Routed links avoid nodes marked as (Markdown/T_MindFusion_Diagramming_DiagramNode.md#obstacle) by finding the shortest path between their origin and destination that does not cross any other nodes.
### Setting Up a Link Router
The control finds paths for links affected by modifications of nearby nodes by calling methods of an object that implements the (Markdown/T_MindFusion_Diagramming_ILinkRouter.md) interface. This object can be get or set through the (Markdown/T_MindFusion_Diagramming_Diagram.md#linkrouter) property of the (Markdown/T_MindFusion_Diagramming_Diagram.md) class. MindFusion.Diagramming provides a few classes that implement (Markdown/T_MindFusion_Diagramming_ILinkRouter.md) - (Markdown/T_MindFusion_Diagramming_PatternRouter.md), (Markdown/T_MindFusion_Diagramming_GridRouter.md), (Markdown/T_MindFusion_Diagramming_QuickRouter.md) and (Markdown/T_MindFusion_Diagramming_CompositeRouter.md). By default (Markdown/T_MindFusion_Diagramming_Diagram.md#linkrouter) is set to a (Markdown/T_MindFusion_Diagramming_CompositeRouter.md) instance.
### Automatic or Explicit Routing
The (Markdown/T_MindFusion_Diagramming_Diagram.md#routealllinks) method can be invoked to explicitly rearrange links in a way they do not cross nodes. In addition, links have an (Markdown/T_MindFusion_Diagramming_DiagramLink.md#autoroute) property that enables or disables automatic routing of a link; that property is initialized from the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#routelinks) member. The (Markdown/T_MindFusion_Diagramming_RoutingOptions.md#triggerrerouting) member of the (Markdown/T_MindFusion_Diagramming_RoutingOptions.md) class specifies when links should be rerouted automatically.
### Tuning the Routing Algorithm
When a (Markdown/T_MindFusion_Diagramming_GridRouter.md) is used, the (Markdown/T_MindFusion_Diagramming_RoutingOptions.md) class allows customizing various aspects of the routing algorithm. That algorithm evaluates possible paths aiming to find one that has a minimal cost. The values of (Markdown/T_MindFusion_Diagramming_RoutingOptions.md#lengthcost), (Markdown/T_MindFusion_Diagramming_RoutingOptions.md#turncost), (Markdown/T_MindFusion_Diagramming_RoutingOptions.md#crossingcost) and (Markdown/T_MindFusion_Diagramming_RoutingOptions.md#nodevicinitycost) are added to the total cost of a route and have a great influence over the shape of the chosen path. The (Markdown/T_MindFusion_Diagramming_RoutingOptions.md#startorientation) and (Markdown/T_MindFusion_Diagramming_RoutingOptions.md#endorientation) properties specify the orientation of the first and last segments of routed links.
## Anchor Points and Patterns
### Anchor Points
For each node you can define one or more points to which links should dock when connecting to that node. Such points are represented by instances of the (Markdown/T_MindFusion_Diagramming_AnchorPoint.md) class. The position of an anchor point relative to node's bounding rectangle is specified via the (Markdown/T_MindFusion_Diagramming_AnchorPoint.md#x) and (Markdown/T_MindFusion_Diagramming_AnchorPoint.md#y) properties. By default, their values are expressed as percent of the node's width and height to accommodate for moving and resizing. The final location of an anchor point is determined by this simple calculation:
```csharp
return new PointF(
nodeRect.X + nodeRect.Width * X / 100,
nodeRect.Y + nodeRect.Height * Y / 100);
```
```
Return New PointF( _
nodeRect.X + nodeRect.Width * X / 100, _
nodeRect.Y + nodeRect.Height * Y / 100)
```
A point's position can also be defined as a fixed offset from the node's top-left corner, letting you define anchor positions that do not depend on the node's width or height. This is controlled independently for (Markdown/T_MindFusion_Diagramming_AnchorPoint.md#x) and (Markdown/T_MindFusion_Diagramming_AnchorPoint.md#y) coordinates, by means of the (Markdown/T_MindFusion_Diagramming_AnchorPoint.md#xunit) and (Markdown/T_MindFusion_Diagramming_AnchorPoint.md#yunit) properties.
You can control whether an anchor point accepts incoming or outgoing links or both. That is done via the (Markdown/T_MindFusion_Diagramming_AnchorPoint.md#allowincoming) and (Markdown/T_MindFusion_Diagramming_AnchorPoint.md#allowoutgoing) properties. When a link is drawn, its ends are aligned to the nearest anchors allowing docking of the respective end type. Another way to control whether links can be connected to an anchor point is to handle the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#validateanchorpoint) event.
### Anchor Patterns
An (Markdown/T_MindFusion_Diagramming_AnchorPattern.md) instance defines a set of anchor points to be used together. When creating an anchor pattern, pass to its constructor an array of (Markdown/T_MindFusion_Diagramming_AnchorPoint.md) objects. The (Markdown/T_MindFusion_Diagramming_AnchorPattern.md) class exposes several predefined patterns as static properties. An existing pattern can be assigned as a single entity to the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#anchorpattern) property of nodes. The following example creates a pattern of four anchor points:
```csharp
apat1 = new AnchorPattern(new AnchorPoint[] {
new AnchorPoint(50, 0, true, true),
new AnchorPoint(100, 50, true, true),
new AnchorPoint(50, 100, true, true),
new AnchorPoint(0, 50, true, true)});
```
```
apat1 = new AnchorPattern(new AnchorPoint() { _
new AnchorPoint(50, 0, true, true), _
new AnchorPoint(100, 50, true, true), _
new AnchorPoint(50, 100, true, true), _
new AnchorPoint(0, 50, true, true) })
```
The points are located at the middles of bounding rectangle sides of nodes to which the pattern is assigned. All four points accept both incoming and outgoing links.
### Anchor Patterns and Tables
A distinct anchor pattern can be assigned to every row of a table. When a link is connected to a row, the respective end of the link is aligned to the nearest (Markdown/T_MindFusion_Diagramming_AnchorPoint.md) assigned to that row. If a row does not have associated anchor points of the appropriate type (incoming/outgoing), the link will be connected to the nearest row that has such anchors defined. If none of the rows of a table has an associated anchor pattern, links are connected to the middle of the left or right side of the pointed row.
### Anchor Points and User Interaction
By default, a link is attached to an anchor point only when the link is created. Afterwards, the user can move the link end to any part of the node. To ensure that links always stay attached to an anchor point even after subsequent modifications done by the user, set the (Markdown/T_MindFusion_Diagramming_Diagram.md#snaptoanchor) property to (Markdown/T_MindFusion_Diagramming_SnapToAnchor.md). You can prevent the user from attaching specific links to specific anchor points by handling the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#validateanchorpoint) event.
### Setting Anchor Point Programmatically
You can connect a link to a specific anchor point by setting the link's (Markdown/T_MindFusion_Diagramming_DiagramLink.md#originanchor) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#destinationanchor) properties to the index of the point in the respective node's (Markdown/T_MindFusion_Diagramming_DiagramNode.md#anchorpattern). The (Markdown/T_MindFusion_Diagramming_DiagramLink.md#reassignanchorpoints) method of (Markdown/T_MindFusion_Diagramming_DiagramLink.md) automatically chooses anchor points of the origin and destination nodes that are close to each other, so that the link takes a shorter path between the nodes. The (Markdown/T_MindFusion_Diagramming_DiagramNode.md#reassignanchorpoints) method of (Markdown/T_MindFusion_Diagramming_DiagramNode.md) sets the anchor point of each link connected to the node so that links are evenly distributed among the available anchor points.
## Undo and Redo
The following topics are contained within this topic:(#overview)
Introduces to the MindFusion.Diagramming undo system.
(#actions-and-commands)
Previews the available actions on a diagram and their associated undo/redo commands.
(#undo-manager)
Introduces the (Markdown/T_MindFusion_Diagramming_UndoManager.md) class.
(#command-history)
Information about the command history where all previously executed commands are stored.
(#undo-or-redo-of-property-changes)
Information on how to undo/redo changes in diagram item properties.
(#composite-commands)
Demonstrates how to encapsulate a set of commands as a single command that can be undone as an atomic operation.
(#subclassing-the-command-class)
Information on how to create custom commands.
## Overview
Interactive actions, carried out by users, and programmatic commands that change the structure of a diagram are recorded in a history queue. While action records are still in that queue, the actions can be undone or redone. The queue has a fixed length - if it gets full, recording a new action makes the oldest one drop from the queue.
Undo is disabled by default. To enable it, set the (Markdown/T_MindFusion_Diagramming_UndoManager.md#undoenabled) property to true. To undo or redo an action, call the (Markdown/T_MindFusion_Diagramming_UndoManager.md#undo) or (Markdown/T_MindFusion_Diagramming_UndoManager.md#redo) methods of (Markdown/T_MindFusion_Diagramming_UndoManager.md). MindFusion.Diagramming does not provide keyboard shortcuts for undo/redo. Your application must have its own menu items and/or keyboard accelerators to provide the necessary user interface, and invoke the respective methods in response to UI events.
MindFusion.Diagramming automatically saves the following types of actions for later undo/redo:
- adding an item to the diagram
- removing an item from the diagram
- moving or resizing items
- creating a group
- destroying a group
- expanding or collapsing trees
- scrolling table rows
- adding or removing tables' rows
Changes to property values are not saved automatically in the history. If your application must be able to undo/redo property changes, use the (Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md) command. (Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md) allows recording several property changes as an atomic undoable action.
In some cases you may need to create your own types of actions or commands. For example, suppose you need to implement undo/redo for changes made to the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag) property of items or changes to controls embedded in (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) items. However, MindFusion.Diagramming is not able to detect such changes, so it cannot undo them. To enable undo/redo you would have to create a subclass of (Markdown/T_MindFusion_Diagramming_Commands_Command.md) and implement its (Markdown/T_MindFusion_Diagramming_Commands_Command.md#execute), (Markdown/T_MindFusion_Diagramming_Commands_Command.md#undo) and (Markdown/T_MindFusion_Diagramming_Commands_Command.md#redo) methods.
## Actions and Commands
Undoable interactive actions and programmatic commands that can be carried out by MindFusion.Diagramming are represented by (Markdown/T_MindFusion_Diagramming_Commands_Command.md) subclasses. The (Markdown/T_MindFusion_Diagramming_Commands_Command.md) class provides the necessary interface to (Markdown/T_MindFusion_Diagramming_Commands_Command.md#execute), (Markdown/T_MindFusion_Diagramming_Commands_Command.md#undo) or (Markdown/T_MindFusion_Diagramming_Commands_Command.md#redo) actions. In some cases you will have to implement these methods in derived classes, but you must not call them directly. Use the (Markdown/T_MindFusion_Diagramming_Commands_Command.md#undo) or (Markdown/T_MindFusion_Diagramming_Commands_Command.md#redo) methods of the (Markdown/T_MindFusion_Diagramming_UndoManager.md) to undo or redo a command. The (Markdown/T_MindFusion_Diagramming_UndoManager.md) methods call the respective (Markdown/T_MindFusion_Diagramming_Commands_Command.md) methods and in addition update the state of the command history and the (Markdown/T_MindFusion_Diagramming_Diagram.md).
The following MindFusion.Diagramming classes are derived from (Markdown/T_MindFusion_Diagramming_Commands_Command.md):
| **Command
** | **Description
**
| (Markdown/T_MindFusion_Diagramming_Commands_AddItemCmd.md)
| Adds a new item to the diagram.
| (Markdown/T_MindFusion_Diagramming_Commands_RemoveItemCmd.md)
| Removes an item from the diagram.
| (Markdown/T_MindFusion_Diagramming_Commands_AddGroupCmd.md)
| Creates a new hierarchical group.
| (Markdown/T_MindFusion_Diagramming_Commands_RemoveGroupCmd.md)
| Destroys a group.
| (Markdown/T_MindFusion_Diagramming_Commands_GroupAttachCmd.md)
| Attaches an item to a group.
| (Markdown/T_MindFusion_Diagramming_Commands_GroupDetachCmd.md)
| Detaches an item from a group.
| (Markdown/T_MindFusion_Diagramming_Commands_ModifyItemCmd.md)
| Moves or resizes an item.
| (Markdown/T_MindFusion_Diagramming_Commands_RedimTableCmd.md)
| Change number of table's columns or rows.
| (Markdown/T_MindFusion_Diagramming_Commands_ExpandItemCmd.md)
| Expands or collapses a tree of items.
| (Markdown/T_MindFusion_Diagramming_Commands_ScrollTableCmd.md)
| Scrolls table's rows.
| (Markdown/T_MindFusion_Diagramming_Commands_ExpandHeaderRowCmd.md)
| Expands or collapses tables sections.
| (Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md)
| Handles undo/redo of item property changes.
| (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md)
| Allows several actions to be undo and redone at the same time.
Instances of most of these classes are created implicitly by MindFusion.Diagramming in response to users' actions or method calls. You might need to explicitly instantiate only (Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md) - to undo or redo property changes - and (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md) - to present several actions as single undoable operation.
The data of your application might be tightly integrated in MindFusion.Diagramming diagrams, for example via (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag) objects or .NET controls embedded in (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) items. In these cases MindFusion.Diagramming cannot detect, undo or redo changes to your data. To enable undo of such changes, you must inherit the (Markdown/T_MindFusion_Diagramming_Commands_Command.md) class and implement your versions of the (Markdown/T_MindFusion_Diagramming_Commands_Command.md#execute), (Markdown/T_MindFusion_Diagramming_Commands_Command.md#undo) and (Markdown/T_MindFusion_Diagramming_Commands_Command.md#redo) methods. To record your own action in the undo/redo history, call the (Markdown/T_MindFusion_Diagramming_Diagram.md#executecommand) method of the (Markdown/T_MindFusion_Diagramming_Diagram.md) class.
## Undo Manager
The undo manager acts as a mediator between commands, the diagram and the command history. It is represented by the (Markdown/T_MindFusion_Diagramming_UndoManager.md) class, whose only instance can be accessed through the (Markdown/T_MindFusion_Diagramming_Diagram.md)'s (Markdown/T_MindFusion_Diagramming_Diagram.md#undomanager) property.
By default undo functionality is disabled - commands are executed, but are not recorded in history for later undo or redo. To enable undo, set (Markdown/T_MindFusion_Diagramming_UndoManager.md#undoenabled) to true. You might need to disable undo before executing actions you don't want end-users to undo, for example creating special start/end nodes. Another situation in which you might want to disable undo is when creating programmatically a lot of new diagram items - say hundreds or thousands. MindFusion.Diagramming creates an undo record for each item creation; if the (Markdown/T_MindFusion_Diagramming_CommandHistory.md#capacity) of the command history is smaller than the number of items created, most of the records will drop from the history queue while adding new ones. That would waste processing power and memory for creating undo records that won't be used.
As an alternative, you can create a composite record by calling (Markdown/T_MindFusion_Diagramming_UndoManager.md#startcomposite). All subsequent create-item actions are saved in the composite. The composite is saved in the undo history as a single record that allows undo or redo of all constituent actions as a single operation. (Markdown/T_MindFusion_Diagramming_UndoManager.md#startcomposite) creates and returns a (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md) instance, which is marked as active composite in the undo manager. While there is an active composite, all actions that are carried out are added to it. Call the (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md#execute) method of the active composite to stop recording subcommands in it and save it in the history as atomic undoable operation.
Use the (Markdown/T_MindFusion_Diagramming_UndoManager.md#undo) and (Markdown/T_MindFusion_Diagramming_UndoManager.md#redo) methods of the undo manager to undo or redo actions. Do not call the respective methods of the (Markdown/T_MindFusion_Diagramming_Commands_Command.md) class - they are called internally by the undo manager, and in addition the current command history position is updated and the diagram view is repainted.
## Command History
The undo/redo history is represented by a (Markdown/T_MindFusion_Diagramming_CommandHistory.md) instance. That instance is created by the (Markdown/T_MindFusion_Diagramming_UndoManager.md) and can be accessed by its (Markdown/T_MindFusion_Diagramming_UndoManager.md#history) property.
The undo manager adds commands to the history after executing them. If the history queue is full, the oldest command records are removed when new ones are added. Use the (Markdown/T_MindFusion_Diagramming_CommandHistory.md#capacity) property of (Markdown/T_MindFusion_Diagramming_CommandHistory.md) to specify how many action records to keep in the queue.
The history has a current-command pointer indicating which are the next commands to undo or redo. If a command is undone, the current pointer in the history queue is moved back and allows undoing even older actions. If the current pointer is not at the last record, any newer commands can be redone again. Each time an action is undone or redone, respectively an (Markdown/T_MindFusion_Diagramming_DiagramBase.md#actionundone) or (Markdown/T_MindFusion_Diagramming_DiagramBase.md#actionredone) event is fired.
To query which are the next commands to be undone or redone, use the (Markdown/T_MindFusion_Diagramming_CommandHistory.md#nextundo) and (Markdown/T_MindFusion_Diagramming_CommandHistory.md#nextredo) read-only properties. They return the (Markdown/T_MindFusion_Diagramming_Commands_Command.md) instances contained in the queue which are referred by the current position pointer. If no further undo or redo is possible, the properties return null (Nothing in Visual Basic). You might use them to indicate to end-users which are the next commands to undo/redo.
```csharp
if (diagram.UndoManager.History.NextUndo == null)
{
// Everything has been undone
miUndo.Enabled = false;
miUndo.Text = "Undo";
}
else
{
if (diagram.UndoManager.History.NextUndo is AddItemCmd)
{
// The next action to undo is item-creation
miUndo.Enabled = true;
miUndo.Text = "Undo Create";
}
}
```
```
If Diagram.UndoManager.History.NextUndo Is Nothing Then
' Everything has been undone
miUndo.Enabled = False
miUndo.Text = "Undo"
Else
If TypeOf Diagram.UndoManager.History.NextUndo Is AddItemCmd Then
' The next action to undo is item-creation
miUndo.Enabled = True
miUndo.Text = "Undo Create"
End If
End If
```
To ban end-users from undoing last commands, clear the command history by invoking the (Markdown/T_MindFusion_Diagramming_CommandHistory.md#clear) method. It is possible to filter some commands so they are not recorded in the history by handling the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#actionrecording) event.
## Undo or Redo of Property Changes
Changes to item properties are not recorded automatically for later undo. To enable undo of property changes, you must explicitly create a (Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md) instance and add it to the history queue.
The (Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md#changeitemcmd) constructor requires a reference to an item as argument and saves the item's initial state to be restored by later (Markdown/T_MindFusion_Diagramming_UndoManager.md#undo). Call the (Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md#execute) method after one or more assignments to item's properties. (Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md#execute) records the final state of the item to be restored by later (Markdown/T_MindFusion_Diagramming_UndoManager.md#redo). This allows changes to several properties of an item to be saved within a single record, which can be undone or redone as a single operation:
```csharp
// Save item state
ChangeItemCmd propChange = new ChangeItemCmd(diagram.Nodes, "Change");
// Change properties
ShapeNode shape = (ShapeNode)diagram.Nodes;
shape.Text = "new text";
shape.Brush = new SolidBrush(Color.Blue);
shape.Shape = Shape.FromId("Ellipse");
// Add to history
propChange.Execute();
```
```
' Save item state
Dim propChange = New ChangeItemCmd(Diagram.Nodes(0), "Change")
' Change properties
Dim shape As ShapeNode = Diagram.Nodes(0)
shape.Text = "new text"
shape.Brush = New SolidBrush(Color.Blue)
shape.Shape = MindFusion.Diagramming.Shape.FromId("Ellipse")
' Add to history
propChange.Execute()
```
You might need to treat changes to several items as an atomic operation. To do so, create a (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md) instance and add the (Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md) commands to the composite by calling the (Markdown/T_MindFusion_Diagramming_Commands_Command.md#addsubcmd) method:
```csharp
if (diagram.Selection.Nodes.Count == 0)
return;
// Make all changes seem like a single operation by
// putting them in composite Command
CompositeCmd composite = new CompositeCmd(
diagram, "Change selection");
foreach (DiagramNode node in diagram.Selection.Nodes)
{
ShapeNode shape = node as ShapeNode;
if (shape == null)
continue;
// Save item state
ChangeItemCmd propChange = new ChangeItemCmd(shape, "Change");
// Change properties
shape.Text = "new text";
shape.Brush = new SolidBrush(Color.Blue);
// Add to the composite
composite.AddSubCmd(propChange);
}
// Store final state of all contained commands
composite.Execute();
```
```
If diagram.Selection.Nodes.Count = 0 Then
Return
End If
' Make all changes seem like a single operation by
' putting them in composite Command
Dim composite As CompositeCmd = New CompositeCmd( _
diagram, "Change selection")
Dim node As DiagramNode
For Each node In diagram.Selection.Nodes
Dim shape As ShapeNode = CType(node, ShapeNode)
If Not shape Is Nothing Then
' Save item state
Dim propChange As ChangeItemCmd = New ChangeItemCmd(shape, "Change")
' Change properties
shape.Text = "new text"
shape.Brush = New SolidBrush(Color.Blue)
' Add to the composite
composite.AddSubCmd(propChange)
End If
Next
' Store final state of all contained commands
composite.Execute()
```
## Composite Commands
Sometimes you might prefer having a set of actions undo and redo as a single atomic operation. MindFusion.Diagramming provides the (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md) class to help you with that. (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md) objects act as containers of other (Markdown/T_MindFusion_Diagramming_Commands_Command.md)-derived objects. When (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md#undo) or (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md#redo) are invoked on a composite command, all its subcommands are respectively undone or redone.
To add a command to the composite call the (Markdown/T_MindFusion_Diagramming_Commands_Command.md#addsubcmd) method. Call (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md#execute) to execute all subcommands contained in the composite. Subcommands are executed or redone in the same order in which they were added to the container, and are undone in the opposite order.
Often MindFusion.Diagramming implicitly generates (Markdown/T_MindFusion_Diagramming_Commands_Command.md) objects in response to users actions or method calls, and automatically records them in the history queue. You do not have direct access to those commands and cannot add them to a composite by (Markdown/T_MindFusion_Diagramming_Commands_Command.md#addsubcmd). To enable creating composites in such cases, the undo manager provides the notion of active composite. Active composite is created by calling the (Markdown/T_MindFusion_Diagramming_UndoManager.md#startcomposite) function of (Markdown/T_MindFusion_Diagramming_UndoManager.md). Each action executed after that is made part of the composite, instead of adding it directly to the command history. Invoking the (Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md#execute) method of the current composite completes it and saves it in the history queue.
```csharp
// Implicitly created undo records will be saved here
CompositeCmd composite = diagram.UndoManager.StartComposite("Create group");
// Call methods that create undo records
ShapeNode node1 = diagram.Factory.CreateShapeNode(0, 0, 30, 30);
ShapeNode node2 = diagram.Factory.CreateShapeNode (0, 0, 15, 15);
Group g = diagram.Factory.CreateGroup(node1);
g.AttachToCorner(node2, 0);
// This goes to the active composite too
ChangeItemCmd change = new ChangeItemCmd(node2, "");
node2.Locked = true;
change.Execute();
// Save the active composite in history
composite.Execute();
```
```
' Implicitly created undo records will be saved here
Dim composite As CompositeCmd = Diagram.UndoManager.StartComposite("Create group")
' Call methods that create undo records
Dim node1 As ShapeNode = Diagram.Factory.CreateShapeNode(0, 0, 30, 30)
Dim node2 As ShapeNode = Diagram.Factory.CreateShapeNode(0, 0, 15, 15)
Dim g As Group = Diagram.Factory.CreateGroup(node1)
g.AttachToCorner(node2, 0)
' This goes to the active composite too
Dim change As New ChangeItemCmd(node2, "")
node2.Locked = True
change.Execute()
' Save the active composite in history
composite.Execute()
```
## Subclassing the Command Class
MindFusion.Diagramming diagrams can be just a part of the data model of your application, which might already have undo/redo functions implemented for its native data. To integrate MindFusion.Diagramming undo functionality into the application's undo mechanism, use the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#actionrecorded) event. When the event is fired, add a corresponding wrapper-record to your application's history from the event handler. The wrapper could just call (Markdown/T_MindFusion_Diagramming_UndoManager.md#undo) and (Markdown/T_MindFusion_Diagramming_UndoManager.md#redo) methods of the (Markdown/T_MindFusion_Diagramming_UndoManager.md). In such situations make sure the MindFusion.Diagramming's history (Markdown/T_MindFusion_Diagramming_CommandHistory.md#capacity) is at least as big as your application's.
Another possibility is to reuse MindFusion.Diagramming's undo functionality by subclassing (Markdown/T_MindFusion_Diagramming_Commands_Command.md) and creating classes responsible for changes in your application's data. When a change occurs outside the diagram, it can still be recorded by calling the (Markdown/T_MindFusion_Diagramming_Diagram.md)'s (Markdown/T_MindFusion_Diagramming_Diagram.md#executecommand) method and integrated into MindFusion.Diagramming's command history.
A simpler scenario when you might have to subclass (Markdown/T_MindFusion_Diagramming_Commands_Command.md) is using complex objects as tags or embedding controls in (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) instances. Actions that change these objects or controls cannot be detected and handled automatically by MindFusion.Diagramming. To integrate such an action into the diagram's undo history, you must create a (Markdown/T_MindFusion_Diagramming_Commands_Command.md) instance that knows how to carry out, undo or redo the action.
(Markdown/T_MindFusion_Diagramming_Commands_Command.md) subclasses must implement (Markdown/T_MindFusion_Diagramming_Commands_Command.md#execute), (Markdown/T_MindFusion_Diagramming_Commands_Command.md#undo) and (Markdown/T_MindFusion_Diagramming_Commands_Command.md#redo) methods. Actions represented by your subclass must be carried out by executing the (Markdown/T_MindFusion_Diagramming_Diagram.md#executecommand) method of (Markdown/T_MindFusion_Diagramming_Diagram.md). (Markdown/T_MindFusion_Diagramming_Diagram.md#executecommand) invokes (Markdown/T_MindFusion_Diagramming_Commands_Command.md#execute) on the command passed as argument, which is then added to the history queue and whose (Markdown/T_MindFusion_Diagramming_Commands_Command.md#undo) and (Markdown/T_MindFusion_Diagramming_Commands_Command.md#redo) methods can be called multiple times later by the undo manager. Usually you can implement (Markdown/T_MindFusion_Diagramming_Commands_Command.md#redo) as a call to (Markdown/T_MindFusion_Diagramming_Commands_Command.md#execute), but if the latter is time consuming, its result state can be saved in an instance member and restored by Redo.
Do not call the (Markdown/T_MindFusion_Diagramming_Commands_Command.md#undo) and (Markdown/T_MindFusion_Diagramming_Commands_Command.md#redo) methods of your class directly, just implement them and they will be invoked by (Markdown/T_MindFusion_Diagramming_UndoManager.md)'s (Markdown/T_MindFusion_Diagramming_UndoManager.md#undo) or (Markdown/T_MindFusion_Diagramming_UndoManager.md#redo) methods when necessary.
The example below shows a simple implementation of (Markdown/T_MindFusion_Diagramming_Commands_Command.md) methods:
```csharp
public class PersonTag
{
public string Name;
public string Address;
// And so on
...
}
public class AddressChangeCmd : Command
{
public AddressChangeCmd(PersonTag p, string address) :
base("Address change")
{
this.p = p;
this.oldAddress = p.Address;
this.newAddress = address;
}
public override void Execute(bool undoEnabled)
{
p.Address = newAddress;
}
public override void Undo()
{
p.Address = oldAddress;
}
public override void Redo()
{
// Undo manager is enabled if Redo is called
// so pass true for the undoEnabled argument
Execute(true);
}
private PersonTag p;
private string oldAddress;
private string newAddress;
}
...
// Somewhere in later code
PersonTag tag = (PersonTag)diagram. ActiveItem.Tag;
AddressChangeCmd cc = new AddressChangeCmd(tag, "far far away");
diagram.ExecuteCommand(cc);
```
```
Public Class PersonTag
Public Name As String
Public Address As String
' And so on
...
End Class
Public Class AddressChangeCmd
Inherits Command
Public Sub New(ByVal p As PersonTag, ByVal address As String)
MyBase.New("Address change")
Me.p = p
Me.oldAddress = p.Address
Me.newAddress = address
End Sub
Protected Overrides Sub Execute(ByVal undoEnabled As Boolean)
p.Address = newAddress
End Sub
Protected Overrides Sub Undo()
p.Address = oldAddress
End Sub
Protected Overrides Sub Redo()
' Undo manager is enabled if Redo is called
' so pass true for the undoEnabled argument
Execute(True)
End Sub
Private p As PersonTag
Private oldAddress As String
Private newAddress As String
End Class
...
' Somewhere in later code
Dim tag As PersonTag = CType(diagram.ActiveItem.Tag, PersonTag)
Dim cc As AddressChangeCmd = New AddressChangeCmd(tag, "far far away")
diagram.ExecuteCommand(cc)
```
## Diagram Serialization and Output
The following topics are contained within this topic:
(#serializing-the-diagram)
Information on how to serialize and deserialize MindFusion.Diagramming diagrams to binary and XML files.
(#printing-and-print-preview)
Information about how to setup, preview and print diagrams.
(#exporting-the-diagram)
How to export diagrams to Image files, Pdf, Svg, Dxf and Visio formats.
## Serializing the Diagram
### XML Serialization
A diagram can be saved as an XML document. To do that, call the (Markdown/T_MindFusion_Diagramming_Diagram.md#savetoxml) method of the (Markdown/T_MindFusion_Diagramming_Diagram.md) class. To deserialize a diagram back from its XML representation, call the (Markdown/T_MindFusion_Diagramming_Diagram.md#loadfromxml) method.
Custom item classes can implement XML serialization for their additional properties by overriding the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#savetoxml) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#loadfromxml) methods. In addition, such classes must specify a string to use as their identifier in the XML document by calling (Markdown/T_MindFusion_Diagramming_Diagram.md#registeritemclass).
The control raises (Markdown/T_MindFusion_Diagramming_DiagramBase.md#serializetag) and (Markdown/T_MindFusion_Diagramming_DiagramBase.md#deserializetag) to enable serialization of complex (Markdown/T_MindFusion_Diagramming_DiagramItem.md#id) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag) objects without overriding the item classes. The (Markdown/T_MindFusion_Diagramming_SerializeTagEventArgs.md#propertyname) event argument specifies which property is being serialized.
### JSON Serialization
To serialize a diagram as a JSON string, call its (Markdown/T_MindFusion_Diagramming_Diagram.md#savetojsonstring) method. To deserialize a diagram back from its JSON representation, call the (Markdown/T_MindFusion_Diagramming_Diagram.md#loadfromjsonstring) method. The (Markdown/T_MindFusion_Diagramming_Diagram.md#savetojson) and (Markdown/T_MindFusion_Diagramming_Diagram.md#loadfromjson) methods serialize the JSON strings to / from files.
Custom item classes can implement JSON serialization for their additional properties by overriding the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#savetojson) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#loadfromjson) methods. Such classes must be registered for serialization by calling the (Markdown/T_MindFusion_Diagramming_Diagram.md#registeritemclass) method and providing a string identifier for the clientClass parameter.
The control raises (Markdown/T_MindFusion_Diagramming_DiagramBase.md#jsonserializetag) and (Markdown/T_MindFusion_Diagramming_DiagramBase.md#jsondeserializetag) to enable serialization of complex (Markdown/T_MindFusion_Diagramming_DiagramItem.md#id) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag) objects without overriding the item classes. The (Markdown/T_MindFusion_Diagramming_JsonSerializeTagEventArgs.md#propertyname) event argument specifies which property is being serialized.
JSON serialization is handled internally by the classes from MindFusion.Json namespace. The JsonValue class represents a property value. Property names and values are stored in instances of the JsonObject dictionary class. The JsonContext class handles the serialization of the (Markdown/T_MindFusion_Diagramming_Diagram.md) properties. The Serialize method is a wrapper over the Serializer class' Serialize method. It takes a JsonObject and serializes it to a string. The Parse method is a wrapper over the Parser class' ReadJsonObject method. It takes a JSON-formatted string and returns a JsonObject with the parsed data.
### Binary Serialization
Diagrams can be serialized in byte sequences wrapped by .NET streams. Such streams may represent files, memory buffers, communication pipes, TCP sockets, and so on. In serialized form a diagram might be saved in a database record too. To save the current diagram into a stream, call the (Markdown/T_MindFusion_Diagramming_Diagram.md#savetostream) method, and respectively to load a diagram from a stream call (Markdown/T_MindFusion_Diagramming_Diagram.md#loadfromstream). Two shortcut methods are provided for work with files. (Markdown/T_MindFusion_Diagramming_Diagram.md#savetofile) creates a disk file and a stream that wraps it and invokes (Markdown/T_MindFusion_Diagramming_Diagram.md#savetostream). (Markdown/T_MindFusion_Diagramming_Diagram.md#loadfromfile) opens a read-stream on a disk file and invokes (Markdown/T_MindFusion_Diagramming_Diagram.md#loadfromstream).
If using custom item classes, binary serialization for their additional properties can be implemented by overriding the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#saveto) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#loadfrom) methods. In addition, such classes must specify a string to use as their identifier in the stream by calling (Markdown/T_MindFusion_Diagramming_Diagram.md#registeritemclass).
All objects referenced by the diagram, such as images and fonts, are serialized together with the diagram elements. The (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#id) objects that are associated with diagram elements are also saved if they are of primitive data types. Tag objects marked as are saved using BinaryFormatter. Note that BinaryFormatter is deprecated in newer .NET versions and, as of .NET 10, can only be used via a NuGet package. As an alternative, implement (Markdown/T_MindFusion_Diagramming_BinarySerializer.md).
## Exporting the Diagram
### Exporting Bitmap Images
You can create a static image representing the current diagram using the (Markdown/T_MindFusion_Diagramming_Diagram.md#createimage) method. The method returns an instance of the System.Drawing.Bitmap class. The following example shows how to export a diagram to a Png image file in response to pressing a button, using the SaveFileDialog control where the location is selected and the name of the image file is entered:
```csharp
private void btnPngExport_Click(object sender, System.EventArgs e)
{
saveFileDialog.DefaultExt = "png";
saveFileDialog.Filter = "PNG files|*.png";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
Image image = diagram1.CreateImage();
image.Save(saveFileDialog.FileName);
image.Dispose();
}
}
```
```
Private Sub btnPngExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPngExport.Click
saveFileDialog.DefaultExt = "png"
saveFileDialog.Filter = "PNG files|*.png"
If saveFileDialog1.ShowDialog() = DialogResult.OK Then
Dim image As Image = diagram1.CreateImage()
image.Save(saveFileDialog1.FileName)
image.Dispose()
End If
End Sub
```
The (#mindfusiondiagrammingexport) Namespace contains classes for exporting to Dxf, Pdf, Svg and Visio formats.
### Exporting to DXF files
Add a reference to the MindFusion.Diagramming.Export.Dxf.dll to your project. Create a (Markdown/T_MindFusion_Diagramming_Export_DxfExporter.md) instance and call its Export method, specifying a (Markdown/T_MindFusion_Diagramming_Diagram.md) object and a file path as arguments. Raster images can be used in DXF by referencing external image files. To export the images displayed in diagram elements, enable the (Markdown/T_MindFusion_Diagramming_Export_DxfExporter.md#exportimages) property. If your application supports the multiple-line text DXF entity - MTEXT, use the (Markdown/T_MindFusion_Diagramming_Export_DxfExporter.md#exporttextasmultiline) property. The following example shows how to create a (Markdown/T_MindFusion_Diagramming_Export_DxfExporter.md) instance and export a diagram by performing the Export method passing the (Markdown/T_MindFusion_Diagramming_Diagram.md) object and the file name entered in a SaveFileDialog.
```csharp
MindFusion.Diagramming.Export.DxfExporter dxfExp = new MindFusion.Diagramming.Export.DxfExporter();
dxfExp.Export(diagramView1.Diagram, saveFileDialog.FileName);
```
### Exporting to PDF files
Add references to the MindFusion.Diagramming.Export.Pdf.dll and MindFusion.Pdf.dll assemblies to your project. Create a (Markdown/T_MindFusion_Diagramming_Export_PdfExporter.md) instance and call its (Markdown/T_MindFusion_Diagramming_Export_PdfExporter.md#export) method. (Markdown/T_MindFusion_Diagramming_Export_PdfExporter.md#margins) specifies the page margins for all pages in the document. If you need to set the page size and orientation, use the (Markdown/T_MindFusion_Diagramming_Export_PdfExporter.md#pagesize), and (Markdown/T_MindFusion_Diagramming_Export_PdfExporter.md#pageorientation) properties. The (Markdown/T_MindFusion_Diagramming_Export_PdfExporter.md#autoscale) property allows scaling the diagram to fit in one or more PDF pages. If invisible items should be displayed in the PDF, enable the (Markdown/T_MindFusion_Diagramming_Export_PdfExporter.md#invisibleitems) property. The following example shows how to export a diagram to a Pdf file in response to pressing a button event and using the SaveFileDialog control where the location is selected and the name of the Pdf file is entered:
```csharp
private void button1_Click(object sender, EventArgs e)
{
saveFileDialog.DefaultExt = "pdf";
saveFileDialog.Filter = "PDF files|*.pdf";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
MindFusion.Diagramming.Export.PdfExporter pdfExp = new MindFusion.Diagramming.Export.PdfExporter();
pdfExp.Export(diagramView1.Diagram, saveFileDialog.FileName);
}
}
```
```
Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
saveFileDialog.DefaultExt = "pdf"
saveFileDialog.Filter = "PDF files|*.pdf"
If saveFileDialog.ShowDialog() = DialogResult.OK Then
pdfExp.Export(diagramView1.Diagram, saveFileDialog.FileName)
End If
End Sub
Dim pdfExp As New MindFusion.Diagramming.Export.PdfExporter
```
### Exporting to SVG files
Add references to the MindFusion.Diagramming.Export.Svg.dll and MindFusion.Svg.dll assemblies to your project. Create an (Markdown/T_MindFusion_Diagramming_Export_SvgExporter.md) instance and call its (Markdown/T_MindFusion_Diagramming_Export_SvgExporter.md#export) method, passing a (Markdown/T_MindFusion_Diagramming_Diagram.md) object and the full path to the .svg file as parameters. To export images displayed by diagram items to external files, enable the (Markdown/T_MindFusion_Diagramming_Export_SvgExporter.md#externalimages) property.
```csharp
MindFusion.Diagramming.Export.SvgExporter svgExp = new MindFusion.Diagramming.Export.SvgExporter();
svgExp.ExternalImages = false;
svgExp.Export(diagramView.Diagram, saveFileDialog.FileName);
```
```
Dim svgExp As MindFusion.Diagramming.Export.SvgExporter = _
New MindFusion.Diagramming.Export.SvgExporter()
svgExp.ExternalImages = False
svgExp.Export(diagramView1.Diagram, saveFileDialog.FileName)
```
### Exporting to Visio files
Add a reference to the MindFusion.Diagramming.Export.Visio.dll to your project. The MindFusion.Diagramming (Markdown/T_MindFusion_Diagramming_ShapeNode.md) objects are mapped to their closest Visio counterparts and (Markdown/T_MindFusion_Diagramming_TableNode.md) objects are exported as groups of Visio shapes. MindFusion.Diagramming (Markdown/T_MindFusion_Diagramming_DiagramLink.md) instances are exported as Visio connectors of a similar style. In addition, most of the attributes of diagram items such as text, text formatting, fill and line colors and styles are preserved.
The exporter object requires the VisioExport.vxt file to be present in the application's directory. This file contains an XML template data used by the component to generate Visio documents.
Create a new instance of the (Markdown/T_MindFusion_Diagramming_Export_VisioExporter.md) class. Call the (Markdown/T_MindFusion_Diagramming_Export_VisioExporter.md#export) method passing a (Markdown/T_MindFusion_Diagramming_Diagram.md) object and the full path to the exported Visio .vdx file as parameters. The Visio page dimension and items size measure unit is set to the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#measureunit).
To create Visio groups from the MindFusion.Diagramming groups, enable the (Markdown/T_MindFusion_Diagramming_Export_VisioExporter.md#createvisiogroups) property. If a shape node that contains an image should be exported as a Visio group of a shape, picture and text objects, use the (Markdown/T_MindFusion_Diagramming_Export_VisioExporter.md#exportimagesasgroups) property set to true by default. (Markdown/T_MindFusion_Diagramming_Export_VisioExporter.md#exportinvisibleitems) allows exporting of invisible items. If MindFusion.Diagramming (Markdown/T_MindFusion_Diagramming_TableNode.md) objects should be exported as groups of Visio rectangular shapes, enable the (Markdown/T_MindFusion_Diagramming_Export_VisioExporter.md#exporttablesasgroups) property.
The following example shows how to export a diagram to a Visio file in response to choosing a File > Export to > Visio menu item and using the SaveFileDialog control where the location is selected and the name of the Visio file is entered:
```csharp
private void _menuItemExportVisio_Click(object sender, System.EventArgs e)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.Filter = "Visio files (*.vdx)|*.vdx|All files|*.*||";
if (dlg.ShowDialog(this) == DialogResult.OK)
{
VisioExporter export = new VisioExporter();
export.Export(_diagram, dlg.FileName);
}
}
```
### Exporting WMF images
Add a reference to the MindFusion.Diagramming.Export.Wmf.dll assembly to your project. Create a (Markdown/T_MindFusion_Diagramming_Export_WmfExporter.md) instance and call its (Markdown/T_MindFusion_Diagramming_Export_WmfExporter.md#export) method, passing a (Markdown/T_MindFusion_Diagramming_Diagram.md) object and the full path to the .wmf file as parameters.
### Exporting Adobe Flash files
Add a reference to the MindFusion.Diagramming.Export.Swf.dll assembly to your project. Create an (Markdown/T_MindFusion_Diagramming_Export_SwfExporter.md) instance and call its (Markdown/T_MindFusion_Diagramming_Export_SwfExporter.md#export) method, passing a (Markdown/T_MindFusion_Diagramming_Diagram.md) object and the full path to the .swf file as parameters.
### Export Excel files
The (Markdown/T_MindFusion_Diagramming_Export_ExcelExporter.md) class from MindFusion.Diagramming.Export.Excel.dll assembly exports diagrams to Excel Open XML Format (XLSX) files. Diagrams are exported as Excel AutoShapes drawings. The (Markdown/T_MindFusion_Diagramming_Export_ExcelExporter.md#export) overload that takes a (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) parameter creates a sheet for each (Markdown/T_MindFusion_Diagramming_DiagramPage.md) in the document. The Export(Diagram) overload creates a single Excel sheet.
## Printing and Print Preview
### Print or Preview a Diagram
Call the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#print) method to print the current diagram. (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#printpreview) displays the standard .NET print-preview window. (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#printpreviewex) displays an extended preview form that provides buttons for choosing page orientation and for scaling the print output.
### Settings for Printing
The (Markdown/T_MindFusion_Diagramming_WinForms_PrintOptions.md) class exposes the available settings for printing and print preview. The visualization properties in that class are used both for printing and for preview. That allows achieving uniform output on the printed pages and on the display. An instance of this structure is accessible via the diagram's (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#printoptions) property.
### Customizing the Extended Print Preview Window
The preview window displayed by (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#printpreviewex) can have its UI elements customized via the (Markdown/T_MindFusion_Diagramming_WinForms_PreviewOptions.md) class. Members of that class allow assigning images to the preview toolbar buttons and changing the tooltip and menu texts to allow localization of the user interface. The appearance settings for the diagram displayed in the preview window are still set through (Markdown/T_MindFusion_Diagramming_WinForms_PrintOptions.md).
### Size of a Printed Diagram
If (Markdown/T_MindFusion_Diagramming_Diagram.md#backgroundimage) is set and (Markdown/T_MindFusion_Diagramming_RenderOptions.md#enablebackgroundimage) is enabled, the size of a printed diagram is defined solely by the (Markdown/T_MindFusion_Diagramming_Diagram.md#bounds) property. If the actual diagram items occupy only a small portion of the document, there might be some pages printed that do not display any items but just a part of the background image. To avoid that, call (Markdown/T_MindFusion_Diagramming_Diagram.md#resizetofititems) before printing.
If no background image is used, MindFusion.Diagramming prints only the part of a document containing all items that are both (Markdown/T_MindFusion_Diagramming_DiagramItem.md#visible) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#printable). That avoids printing blank pages.
### Print Scaling
The (Markdown/T_MindFusion_Diagramming_RenderOptions.md#scale) property allows printing a diagram in larger or smaller proportions than the actual ones. (Markdown/T_MindFusion_Diagramming_WinForms_PrintOptions.md#scaletopage) automatically calculates (Markdown/T_MindFusion_Diagramming_RenderOptions.md#scale) so that the whole diagram fits in a single printed page.
### Offscreen Printing
You can print diagrams without showing them in a (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) by means of the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramPrinter.md) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramDocumentPrinter.md) classes. The former lets you print a diagram assigned to the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramPrinter.md#diagram) property, while the latter prints a (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) assigned to its (Markdown/T_MindFusion_Diagramming_WinForms_DiagramDocumentPrinter.md#document) property.
## Appearance
The following topics are contained within this topic:
(#styles-and-themes)
Provides information on how to use styles and themes and how to create styles for custom items.
(#brush-and-pen-classes)
Introduces the MindFusion wrappers of the standard GDI+ pens and brushes.
(#node-effects)
Information on how to apply the built-in node effects.
(#customizing-the-appearance-of-items)
Information about how to modify various aspects of the appearance of individual diagram items.
(#user-defined-node-shapes-and-custom-drawing)
Information on how to define arbitrary node shapes as well as how to use custom-drawing.
(#text-attributes-and-formatting)
Provides information on how to customize the text of diagram items and lists all possible formatting tags.
(#modifying-the-diagram-appearance)
General options affecting the appearance of a MindFusion.Diagramming diagram.
## Styles and Themes
The style and theme system provides a consistent way to customize the appearance of a (Markdown/T_MindFusion_Diagramming_Diagram.md) and its items. By using styles and themes, it is easier to achieve coherent look and feel across the entire diagram. In addition, changing the look and feel can be achieved by simply replacing the current theme. New themes can be designed in the visual environment of the Theme Editor tool and subsequently used and distributed as XML files. Several pre-defined theme files are installed under the Themes subfolder of the control's root installation folder.
### Styles
The style is a set of properties. Styles can be applied to diagrams and individual diagram items and this can potentially affect the values of some properties of the target object. More specifically, if the value of a style-affected property in the target object is null, then the value is obtained from the associated style. The style does not necessarily need to provide values for all of its properties. If a styled property is null and it is not defined in the associated style, the style system searches for a value in the current theme. A complete value precedence list can be found later in this topic.
The styles are represented by the (Markdown/T_MindFusion_Diagramming_Style.md) class and its various subclasses. Styles can be applied to diagram objects through the (Markdown/T_MindFusion_Diagramming_Diagram.md#style) property of the (Markdown/T_MindFusion_Diagramming_Diagram.md) class and to diagram items through the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#style) property of the (Markdown/T_MindFusion_Diagramming_DiagramItem.md) class. Styles can also participate in themes, in which case they affect all objects of specific type.
### Themes
The theme is a set of styles, each associated with specific diagram or item type. When the theme is applied to a diagram, the styles registered in the theme affect all objects of their associated type.
Themes are represented by the (Markdown/T_MindFusion_Diagramming_Theme.md) class and can be assigned to (Markdown/T_MindFusion_Diagramming_Diagram.md) objects through the (Markdown/T_MindFusion_Diagramming_Diagram.md#theme) property. Styles are associated with types within the theme through the (Markdown/T_MindFusion_Diagramming_Theme.md#registerstyle) method. The following code creates a new theme, with a single style for (Markdown/T_MindFusion_Diagramming_ShapeNode.md) items and applies this theme to an existing diagram.
```csharp
Theme theme = new Theme();
ShapeNodeStyle style = new ShapeNodeStyle();
style.FontFamily = "Courier New";
theme.RegisterStyle(typeof(ShapeNode), style);
diagram.Theme = theme;
```
```vbnet
Dim theme As New Theme()
Dim style As New ShapeNodeStyle()
style.FontFamily = "Courier New"
theme.RegisterStyle(GetType(ShapeNode), style)
diagram.Theme = theme
```
Alternatively, themes can be loaded from XML files by calling the (Markdown/T_MindFusion_Diagramming_Theme.md#loadfromxml) method. Such XML files can be produced by the Theme Editor tool, or by calling the (Markdown/T_MindFusion_Diagramming_Theme.md#savetoxml) method of an existing theme.
### Value Precedence
The style and theme system is hierarchical. This means that, when a value of a styled property is requested, the system starts searching for this value along a chain of defined styles. The system returns the first valid value encountered. If no valid value is encountered along the chain, the system returns a globally defined default value for the property. The following list explains the search order in more details:
If the local value of the object is not null, the local value is returned.
- If the object has a style and the property in this style has value, this value is returned.
- If the object is an item, which is part of a diagram, the local style of the diagram is searched.
- If the object is an item, which is part of a diagram and the diagram has associated theme, the theme is searched for styles registered for the item's type or its base types. If a style with a defined property value is found, this value is returned.
- Similar search as the previous one is performed for a theme-registered style for the (Markdown/T_MindFusion_Diagramming_Diagram.md) class.
- If the above steps do not produce value; the system returns a globally define default for the property.
For example, if the effective value of the text brush property of a (Markdown/T_MindFusion_Diagramming_ShapeNode.md) is requested (through the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#effectivetextbrush) property), the style system performs the following search, according to the above rules:
If (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush) is not null, (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush) is returned.
- If (Markdown/T_MindFusion_Diagramming_DiagramItem.md#style) is set and the (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#textbrush) property in this style has value, this value is returned.
- If the node is part of a diagram, the (Markdown/T_MindFusion_Diagramming_Diagram.md#style) is set, and the (Markdown/T_MindFusion_Diagramming_DiagramStyle.md#textbrush) property of this style has value, this value is returned.
- If the node is part of a diagram and the (Markdown/T_MindFusion_Diagramming_Diagram.md#theme) is set, the theme is searched for a style registered for the (Markdown/T_MindFusion_Diagramming_ShapeNode.md) type. If there is such style and its (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#textbrush) property has value, this value is returned.
- Similar search as the previous one is performed for a theme-registered style for the (Markdown/T_MindFusion_Diagramming_Diagram.md) type.
- Finally, the system returns a globally-defined default value for the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush) property (which is a solid Black brush).
### Theme Editor
The Theme Editor provides simple visual environment for theme creation and modification. The editor displays a sample diagram with items of various types and exposes a list of all possible built-in diagram and item styles through a property grid to the left. Any modification of the style properties in the grid is immediately reflected on the diagram to give a preview on what effect the change would have if the theme is applied to a diagram. The theme can be saved at any time through the Save menu. Existing themes can be opened and modified.
The following image illustrates the Theme Editor in action:
### Custom Styles
The following section describes how to enable styling for properties of custom item classes. To enable styling, create a custom style class by deriving from the closest existing type. For example, for a custom (Markdown/T_MindFusion_Diagramming_ShapeNode.md) (say, MyNode), the custom style needs to inherit from (Markdown/T_MindFusion_Diagramming_ShapeNodeStyle.md):
```csharp
public class MyNodeStyle : ShapeNodeStyle
{
}
```
```
Public Class MyNodeStyle
Inherits ShapeNodeStyle
End Class
```
For each property in MyNode that needs to be styled, define a property with the same name and type in the MyNodeStyle class by following the pattern below. For example, if MyNode contains a property MyBrush of type (Markdown/T_MindFusion_Drawing_Brush.md), the following code defines its corresponding style property:
```csharp
public class MyNodeStyle : ShapeNodeStyle
{
public MyNodeStyle()
{
myBrushProperty = RegisterProperty("MyBrush");
}
public Brush MyBrush
{
get { return (Brush)GetValue(myBrushProperty); }
set { SetValue(myBrushProperty, value); }
}
private object myBrushProperty;
}
```
```
Public Class MyNodeStyle
Inherits ShapeNodeStyle
Public Sub New()
myBrushProperty = RegisterProperty("MyBrush")
End Sub
Public Property MyBrush() As Brush
Get
Return DirectCast(GetValue(myBrushProperty), Brush)
End Get
Set
SetValue(myBrushProperty, value)
End Set
End Property
Private myBrushProperty As Object
End Class
```
Now, in the custom MyNode class, define a new property, EffectiveMyBrush, which will return the actual value of MyBrush:
```csharp
public Brush EffectiveMyBrush
{
get
{
// Checking for local value
if (MyBrush != null)
return MyBrush;
// Querying the property value through the style system
return (Brush)GetValue("MyBrush");
}
}
```
```
Public ReadOnly Property EffectiveMyBrush() As Brush
Get
' Checking for local value
If MyBrush IsNot Nothing Then
Return MyBrush
End If
' Querying the property value through the style system
Return DirectCast(GetValue("MyBrush"), Brush)
End Get
End Property
```
Remember to register the style class for serialization, along with the custom node class:
```csharp
Diagram.RegisterClass(typeof(MyNode), "MyNode", 1);
Diagram.RegisterClass(typeof(MyNodeStyle), "MyNodeStyle", 1);
```
```
Diagram.RegisterClass(GetType(MyNode), "MyNode", 1)
Diagram.RegisterClass(GetType(MyNodeStyle), "MyNodeStyle", 1)
```
Now you can style and theme your custom nodes. Here is a theme, which affects the MyBrush property of all MyNode items in a diagram:
```csharp
Theme theme = new Theme();
MyNodeStyle myNodeStyle = new MyNodeStyle();
myNodeStyle.MyBrush = new SolidBrush(Color.PaleGoldenrod);
theme.RegisterStyle(typeof(MyNode), myNodeStyle);
diagram.Theme = theme;
```
```
Dim theme As New Theme()
Dim myNodeStyle As New MyNodeStyle()
myNodeStyle.MyBrush = New SolidBrush(Color.PaleGoldenrod)
theme.RegisterStyle(GetType(MyNode), myNodeStyle)
diagram.Theme = theme
```
It is important to remember that there are no global default values for custom properties. Therefore you should be prepare to handle null values from (Markdown/T_MindFusion_Diagramming_DiagramItem.md#getvalue) or ensure that at least one of the five steps in the precedence list above produces a value.
## Brush and Pen Classes
MindFusion.Diagramming defines proxy classes to wrap the functionality of standard .NET brushes and pens and expose them as properties of diagram elements. Those classes, located in the (#mindfusiondrawing) namespace, have the same names as their System.Drawing counterparts. There are five brush classes that inherit the abstract class (Markdown/T_MindFusion_Drawing_Brush.md), namely (Markdown/T_MindFusion_Drawing_HatchBrush.md), (Markdown/T_MindFusion_Drawing_LinearGradientBrush.md), (Markdown/T_MindFusion_Drawing_PathGradientBrush.md), (Markdown/T_MindFusion_Drawing_SolidBrush.md) and (Markdown/T_MindFusion_Drawing_TextureBrush.md). There's also a (Markdown/T_MindFusion_Drawing_Pen.md) class - proxy for the .NET Pen.
There are two reasons to use proxy classes instead the original GDI classes. First, the GDI resources are limited and would be exhausted by keeping a GDI pen and brush attached all the time to each diagram element; by using proxies the GDI pen and brush are created only at the time of drawing, and immediately disposed after that. Second, the GDI Pen and Brush classes don't support serialization; the proxy-classes implement the required interfaces instead.
Otherwise the proxy classes expose the same properties as their GDI counterparts. You might set default pen and brush properties like this:
```csharp
diagram.ShapeBrush = new MindFusion.Drawing.LinearGradientBrush(
Color.Yellow, Color.BurlyWood, 20);
MindFusion.Drawing.Brush penBrush = new MindFusion.Drawing.LinearGradientBrush(
Color.Bisque, Color.Blue, 0);
diagram.ShapePen = new MindFusion.Drawing.Pen(penBrush);
```
```
Diagram.ShapeBrush = New MindFusion.Drawing.LinearGradientBrush( _
Color.Yellow, Color.BurlyWood, 20)
Dim penBrush As MindFusion.Drawing.Brush = New MindFusion.Drawing.LinearGradientBrush( _
Color.Bisque, Color.Blue, 0)
Diagram.ShapePen = New MindFusion.Drawing.Pen(penBrush)
```
After that piece of code is executed, every new shape node created will have gradient brush and pen.
Instances of those classes can be assigned to the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#pen) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#brush) properties of each diagram element.
## Node Effects
To apply an effect to the nodes in a diagram, create an instance of one of the effect classes and add this instance to the (Markdown/T_MindFusion_Diagramming_Diagram.md#nodeeffects) collection. To apply the effect to individual nodes, add the instance to the node's (Markdown/T_MindFusion_Diagramming_DiagramNode.md#effects) collection. To discard the diagram effects for a particular node, add a null reference (Nothing in Visual Basic) at position 0 in the node's (Markdown/T_MindFusion_Diagramming_DiagramNode.md#effects) collection. Effects can also be applied through styles by adding them to the (Markdown/T_MindFusion_Diagramming_DiagramStyle.md#nodeeffects) and (Markdown/T_MindFusion_Diagramming_DiagramNodeStyle.md#effects) collections respectively.
It is possible to combine different effects by adding instances of their appropriate types to the effect collections. If is also admissible to apply more than one effect of the same type.
The currently supplied effect types are Aero, Emboss, Glass, and Smooth Shadow. They are examined in more details in the sections below.
### Aero Effect
The Aero effect is represented by the (Markdown/T_MindFusion_Diagramming_AeroEffect.md) class. The effect is designed to roughly resemble the Aero theme of Windows. More specifically, the effect adds semi transparency to the nodes, a smooth shade at the outside and a thin inset stroke. The semi transparency is specified through the (Markdown/T_MindFusion_Diagramming_AeroEffect.md#opacity) property. Opacity varies from 0 to 1 inclusive, where 0 indicates full transparency and 1 indicates the original node color. The semi transparency is applied only on the node brush. The colors of the shade and the inner stroke are specified through the (Markdown/T_MindFusion_Diagramming_AeroEffect.md#shadecolor) and (Markdown/T_MindFusion_Diagramming_AeroEffect.md#inneroutlinecolor) properties respectively. The following image illustrates how these properties affect the output:
The following example applies the Aero effect on the nodes of an existing diagram:
```csharp
AeroEffect effect = new AeroEffect();
effect.Opacity = 0.5f;
effect.InnerOutlineColor = Color.FromArgb(100, Color.White);
diagram.NodeEffects.Add(effect);
```
```
Dim effect As New AeroEffect()
effect.Opacity = 0.5F
effect.InnerOutlineColor = Color.FromArgb(100, Color.White)
diagram.NodeEffects.Add(effect)
```
### Tips
- The Aero effect works very well in scenarios with overlapping nodes or in cases where the background is more complex than solid color, due to the effect of semi transparency.
- Aero combines well with the Glass effect. There are some examples at the end of this topic.
- The (Markdown/T_MindFusion_Diagramming_AeroEffect.md#shadecolor) is usually black or another dark color. However, some nice glow effects can be achieved by setting bright (Markdown/T_MindFusion_Diagramming_AeroEffect.md#shadecolor) on a diagram with dark background.
- The Aero effect can impact performance if there are many nodes visible in the diagram.
### Emboss Effect
The Emboss effect is represented by the (Markdown/T_MindFusion_Diagramming_EmbossEffect.md) class. The Emboss effect can be alternatively toggled through the (Markdown/T_MindFusion_Diagramming_Diagram.md#enableembosseffects) property. In order for this effect to work a valid (Markdown/T_MindFusion_Diagramming_IEffectsProvider.md) implementation needs to be supplied to the (Markdown/T_MindFusion_Diagramming_Diagram.md#effectsprovider) property. The following image illustrates this effect:
### Glass Effect
The Glass effect is represented by the (Markdown/T_MindFusion_Diagramming_GlassEffect.md) class. The Glass effect adds visuals on top of the nodes in order to give the impression of a reflective surface. There are several variations of this effect, which can be selected through the (Markdown/T_MindFusion_Diagramming_GlassEffect.md#type) property. The color of the reflection and the ambient color can be specified through the (Markdown/T_MindFusion_Diagramming_GlassEffect.md#reflectioncolor) and (Markdown/T_MindFusion_Diagramming_GlassEffect.md#glowcolor) properties respectively. When (Markdown/T_MindFusion_Diagramming_GlassEffect.md#usepenasglow) is set to true the color of the node's pen is used as the ambient color. The following image illustrates the differences between the distinct effect types:
The following example applies a Glass effect with the default settings to the nodes of a diagram:
```csharp
diagram.NodeEffects.Add(new GlassEffect());
```
```
diagram.NodeEffects.Add(New GlassEffect())
```
### Tips
- The (Markdown/T_MindFusion_Diagramming_GlassEffect.md#glowcolor) is usually white. However, for (Markdown/T_MindFusion_Diagramming_GlassEffectType.md) glass effects it is often more suitable to use black glow.
- The Glass effect combines well with the Aero effect. There are some examples at the end of this topic.
- Several glass effects of different types can be applied simultaneously for emphasized effect.
### Smooth Shadow Effect
The Smooth Shadow effect is represented by the (Markdown/T_MindFusion_Diagramming_SmoothShadowEffect.md) class. This effect can be alternatively toggled through the (Markdown/T_MindFusion_Diagramming_Diagram.md#enableshadoweffects) property. In order for this effect to work a valid (Markdown/T_MindFusion_Diagramming_IEffectsProvider.md) implementation needs to be supplied to the (Markdown/T_MindFusion_Diagramming_Diagram.md#effectsprovider) property. In addition, the shadows should be enabled (through (Markdown/T_MindFusion_Diagramming_Diagram.md#shadowsstyle)). The following image illustrates this effect:
### Examples
The values of the effect properties are usually selected in accordance with the color scheme of the target diagram and the desired end result. In addition different types of effects can be applied simultaneously to achieve more interesting results. The examples below demonstrate possible effect combinations in various color contexts.
### Aero & Glass (Dark on Light)
In this example the Aero and Glass effects are combined. The Aero effect is useful in scenarios when dark nodes are placed on light background or vice versa, in order to emphasize the contrast.
Here is the code that applies the above effects:
```csharp
diagram.NodeEffects.Add(new GlassEffect());
diagram.NodeEffects.Add(new AeroEffect());
```
```
diagram.NodeEffects.Add(New GlassEffect())
diagram.NodeEffects.Add(New AeroEffect())
```
### Aero & Glass (Light on Dark)
This example is similar to the first one, only this time the nodes are painted in light colors and the background is dark.
Here is the code that applies the above effect:
```csharp
GlassEffect glassEffect = new GlassEffect();
glassEffect.Type = GlassEffectType.Type3;
diagram.NodeEffects.Add(glassEffect);
diagram.NodeEffects.Add(new AeroEffect());
```
```
Dim glassEffect As New GlassEffect()
glassEffect.Type = GlassEffectType.Type3
diagram.NodeEffects.Add(glassEffect)
diagram.NodeEffects.Add(New AeroEffect())
```
### Glass & Smooth Shadow
This example illustrates how to emphasize the glass effect by combining it with a Smooth Shadow effect. The nodes have semitransparent fills so that the shadow can be seen through them in order to improve the glass impression.
Here is the code that applies the above effects:
```csharp
// Make sure that the shadows in the diagram are enabled and nodes are assigned semitransparent brushes
diagram.NodeEffects.Add(new GlassEffect());
diagram.NodeEffects.Add(new SmoothShadowEffect());
```
```
' Make sure that the shadows in the diagram are enabled and nodes are assigned semitransparent brushes
diagram.NodeEffects.Add(New GlassEffect())
diagram.NodeEffects.Add(New SmoothShadowEffect())
```
### Glow Effect
This example uses bright colors on black background to create a glow effect. The example utilizes an Aero effect with (Markdown/T_MindFusion_Diagramming_AeroEffect.md#shadecolor) set to the color of the nodes' pens.
Here is the code that applies the above effects:
```csharp
GlassEffect glassEffect = new GlassEffect();
glassEffect.Type = GlassEffectType.Type2;
glassEffect.UsePenAsGlow = true;
diagram.NodeEffects.Add(glassEffect);
AeroEffect aeroEffect = new AeroEffect();
aeroEffect.Opacity = 0;
aeroEffect.InnerOutlineColor = Color.Black;
aeroEffect.ShadeColor = Color.FromArgb(128, 255, 255);
diagram.NodeEffects.Add(aeroEffect);
```
```
Dim glassEffect As New GlassEffect()
glassEffect.Type = GlassEffectType.Type2
glassEffect.UsePenAsGlow = True
diagram.NodeEffects.Add(glassEffect)
Dim aeroEffect As New AeroEffect()
aeroEffect.Opacity = 0
aeroEffect.InnerOutlineColor = Color.Black
aeroEffect.ShadeColor = Color.FromArgb(128, 255, 255)
diagram.NodeEffects.Add(aeroEffect)
```
For the rest of the settings for all of the above examples, refer to the Effects sample.
## Customizing the Appearance of Items
For every diagram item, different visual styles and properties can be set as described in the following paragraphs.
### Line Width and Style
When customizing items through styles and themes, the appearance of their border lines can be set via the (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#stroke) and (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#strokethickness) properties of (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md). The borders or segment lines of individual nodes or links can be customized through the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#pen) property. Links provide an additional property for customizing the borders of their arrowheads, called (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headpen).
### Color of Diagram Elements
The color of link segments can be set using the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#pen) property. The borders of arrowheads are drawn using (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headpen). (Markdown/T_MindFusion_Diagramming_DiagramItem.md#brush) specifies how closed arrowhead shapes are filled. It is also possible to define distinct fill style for each type of arrowheads by means of the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headbrush), (Markdown/T_MindFusion_Diagramming_DiagramLink.md#basebrush) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#intermediatebrush) properties. (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush) is used for rendering link's text.
Nodes have three properties for colors: the color of node borders is specified through the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#pen) property; the interior of a node is filled using (Markdown/T_MindFusion_Diagramming_DiagramItem.md#brush); (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush) specifies the color for rendering text. Tables have a special property for their caption color - (Markdown/T_MindFusion_Diagramming_TableNode.md#captionbrush).
### Text
Diagram items can have attached text, displayed inside / over them.
Text of shape nodes is set using their (Markdown/T_MindFusion_Diagramming_ShapeNode.md#text) property and the text format and alignment style is specified using (Markdown/T_MindFusion_Diagramming_ShapeNode.md#textformat). The text of shape nodes can be laid out and rendered inside a polygonal outline; that depends on the value of (Markdown/T_MindFusion_Diagramming_ShapeNode.md#polygonaltextlayout). To make a node big enough to display its text without clipping, call (Markdown/T_MindFusion_Diagramming_ShapeNode.md#resizetofittext).
Links have their text drawn horizontally above their middle segment or rotated as specified via (Markdown/T_MindFusion_Diagramming_DiagramLink.md#textstyle); the string to display can be set using the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#text) property.
Tables have caption text specified via (Markdown/T_MindFusion_Diagramming_TableNode.md#caption); table cells expose (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md#text) property and their text can be formatted via (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md#textformat).
All diagram items expose (Markdown/T_MindFusion_Diagramming_DiagramItem.md#font) property, specifying the name, style and size of the font of item's text. The color of item's text is set in its (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush) property.
### Images
Shape nodes and tables can display images inside them. Use (Markdown/T_MindFusion_Diagramming_ShapeNode.md#image) and (Markdown/T_MindFusion_Diagramming_TableNode.md#image) properties to load images into the respective items. A node can be made the same size as the image it contains by calling (Markdown/T_MindFusion_Diagramming_ShapeNode.md#resizetofitimage).
Images can be positioned in different ways: they can be tiled, stretched or aligned to the containing nodes' centers or sides. Use (Markdown/T_MindFusion_Diagramming_ShapeNode.md#imagealign) and (Markdown/T_MindFusion_Diagramming_TableNode.md#imagealign) to specify how images are placed within the corresponding nodes. An image shown inside a node is clipped in accordance with the shape of that node.
Table cells can have (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md#image) and (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md#imagealign) assigned too. For example that might be used to display an icon for the key field of a database table.
### Shadows
The shadow of each diagram item can be painted with a distinct brush, as specified via the item's (Markdown/T_MindFusion_Diagramming_DiagramItem.md#shadowbrush) property. Shadow offsets from their items can be set individually via the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#shadowoffsetx) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#shadowoffsety) properties. Set those to zero to hide item's shadow.
### DiagramLink-specific Properties
The shape and orientation of link segments is specified by the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#shape) property; the number of segments is specified by the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#segmentcount) property. The form and size of the arrowhead shape is set using the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headshape) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headshapesize) properties. Shapes displayed at the origin of links are defined by (Markdown/T_MindFusion_Diagramming_DiagramLink.md#baseshape) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#baseshapesize). Shapes can be displayed at middles of segments, helping to follow the path of long links. They are defined by the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#intermediateshape) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#intermediateshapesize) properties. The lines of arrowhead shapes are painted using the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headpen) pen. Custom painting code may be invoked for a link, as set in (Markdown/T_MindFusion_Diagramming_DiagramLink.md#customdraw).
### Rounded Links
Links comprising straight segments, that is, ones whose (Markdown/T_MindFusion_Diagramming_DiagramLink.md#shape) is set to (Markdown/T_MindFusion_Diagramming_LinkStyle.md) or (Markdown/T_MindFusion_Diagramming_LinkStyle.md), can use arcs to join their adjacent segments. To enable that feature, set (Markdown/T_MindFusion_Diagramming_Diagram.md#roundedlinks) to true. Use (Markdown/T_MindFusion_Diagramming_Diagram.md#roundedlinksradius) to set the radius of the joining arcs.
### Link Crossings
Intersection points where links cross their paths can be rendered as arcs or breaks, as specified via (Markdown/T_MindFusion_Diagramming_Diagram.md#linkcrossings). It depends on the Z-order, which links jump over the others, or which links appear cut by the others. If (Markdown/T_MindFusion_Diagramming_Diagram.md#linkcrossings) is set to (Markdown/T_MindFusion_Diagramming_LinkCrossings.md), links with higher (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zindex) jump over those with lower (Markdown/T_MindFusion_Diagramming_DiagramItem.md#zindex). If set to (Markdown/T_MindFusion_Diagramming_LinkCrossings.md), links at lower Z position are cut by links at higher Z. Radius of arcs and breaks can be set through the (Markdown/T_MindFusion_Diagramming_Diagram.md#crossingradius) property.### ShapeNode-specific Properties
The shape of a node is defined using its (Markdown/T_MindFusion_Diagramming_ShapeNode.md#shape) property. Shape templates can be applied to a shape node with an orientation of 0/90/180/270 degrees as specified via the (Markdown/T_MindFusion_Diagramming_ShapeNode.md#shapeorientation) property. Your own drawing code may be invoked for a node, depending on the value of (Markdown/T_MindFusion_Diagramming_ShapeNode.md#customdraw). Shape nodes can be marked as (Markdown/T_MindFusion_Diagramming_ShapeNode.md#transparent), having only their text or images rendered.
### TableNode-specific Properties
The outline of a table can be either a rectangle or rounded rectangle, as specified via the (Markdown/T_MindFusion_Diagramming_TableNode.md#shape) property. The borders of table cells can be rendered in different ways, depending on the value of (Markdown/T_MindFusion_Diagramming_TableNode.md#cellframestyle). The table's caption bar is painted using the (Markdown/T_MindFusion_Diagramming_TableNode.md#captionbackbrush) brush. Custom painting can be performed on a table and its cells as set in the (Markdown/T_MindFusion_Diagramming_TableNode.md#customdraw) and (Markdown/T_MindFusion_Diagramming_TableNode.md#cellcustomdraw) properties.
## Animations
### Item Animations
The (Markdown/T_MindFusion_Diagramming_DiagramItem.md#animate) method of (Markdown/T_MindFusion_Diagramming_DiagramItem.md) can run following animations:
- (Markdown/T_MindFusion_Diagramming_Animations_FillColorAnimation.md) animates the fill color of nodes or link arrowheads.
- (Markdown/T_MindFusion_Diagramming_Animations_StrokeColorAnimation.md) animates the color of node borders or link segments.
- (Markdown/T_MindFusion_Diagramming_Animations_OpacityAnimation.md) animates items' opacity for fade-in and fade-out effects.
The following animations can be applied to (Markdown/T_MindFusion_Diagramming_DiagramNode.md)s:
- (Markdown/T_MindFusion_Diagramming_Animations_BounceAnimation.md) animates vertical position of nodes.
- (Markdown/T_MindFusion_Diagramming_Animations_ShakeAnimation.md) animates horizontal position of nodes.
- (Markdown/T_MindFusion_Diagramming_Animations_PulseAnimation.md) animates node's local scale factor.
- (Markdown/T_MindFusion_Diagramming_Animations_PathAnimation.md) moves nodes along specified path.
Item's animated values are considered transient and do not change actual property values. If you want to assign last value from animation to actual property such as (Markdown/T_MindFusion_Diagramming_DiagramNode.md#bounds) or (Markdown/T_MindFusion_Diagramming_DiagramItem.md#opacity), set the KeepLastValue flag in AnimationOptions:
```csharp
node.Animate(
new PathAnimation(
new List
{
new PointF(30, 30),
new PointF(50, 30),
new PointF(75, 66),
new PointF(125, 88)
},
new AnimationOptions
{
KeepLastValue = true
}));
```
Other AnimationOptions properties include Duration, Repeat, RepeatCount, From / To values, animation curve and easing options:
```csharp
node.Animate(
new OpacityAnimation(
new AnimationOptions
{
FromValue = 1,
ToValue = 0.5,
Duration = 222,
Repeat = true,
RepeatCount = 4,
Reverse = true,
AnimationType = AnimationType.BackBow
}));
```
Item and view animations that affect different properties can run simultaneously.
### View Animations
The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#animate) method of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) can run following animations:
- (Markdown/T_MindFusion_Diagramming_WinForms_ScrollAnimation.md) animates the scroll position of a view.
- (Markdown/T_MindFusion_Diagramming_WinForms_ZoomAnimation.md) animates the zoom factor of a view.
```csharp
diagramView.Animate(
new ScrollAnimation(
new AnimationOptions
{
FromValue = new PointF(0, 0),
ToValue = new PointF(100, 60),
AnimationType = AnimationType.Power,
EasingType = EasingType.EaseInOut
}));
```
View animations are not transient and always set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#scrollx) or (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#zoomfactor) properties.
### Looping Animations
To create looping animations, use the Repeat and Reverse properties of the AnimationOptions class. If RepeatCount is not set, the animation repeats indefinitely, and can be stopped by calling its Stop method.
```csharp
// Set this property to repeat the animation until stopped.
animationOptions.Repeat = true;
// Set this property to reverse the to and from values.
animationOptions.Reverse = true;
// At a later point, call Stop to complete the animation.
animation.Stop();
```
### Custom Animations
To animate arbitrary attributes of any type, an Animation instance can receive an UpdateCallback function as a parameter to the constructor. This callback function can be used to set item coordinates or property values of the object being animated. The callback signature should contain two arguments - the animation object instance and a value representing the animated property delta. This callback is called at every animation timer "tick". The following example creates a pulse-like effect, using an UpdateCallback:
```csharp
using MindFusion.Animations;
using MindFusion.Diagramming;
public void Pulse(Animation animation, double animationDelta)
{
var node = animation.Item as DiagramNode;
var delta = (float)animationDelta;
var bounds = node.Bounds;
var to = (float)animation.Options.ToValue;
bounds = RectangleF.Inflate(bounds, to * delta, to * delta);
node.SetBounds(bounds, true, true);
diagram.Invalidate();
}
// ...
var animationOptions = new AnimationOptions();
animationOptions.FromValue = -0.15f;
animationOptions.ToValue = 0.15f;
animationOptions.Duration = 550;
animationOptions.Repeat = true;
animationOptions.Reverse = true;
var animation = new Animation(node, animationOptions, Pulse);
animation.Start();
```
Alternatively, a class derived from Animation could override the virtual UpdateAnimation method.
### Default Animation and Easing Functions
There are seven default animation type functions that can be used to animate items, designated by respective elements of AnimationType enumeration:
- Linear: represents an animation that accelerates / decelerates using a linear function.
- Power: represents an animation that accelerates / decelerates through exponentiation formula - x^n where n can be set through the AnimationOptions' Param property. The default exponent value is 2.
- Exponential: represents an animation that accelerates / decelerates using an exponential function. The exponent can be set through the AnimationOptions' Param property. The default exponent value is 10.
- Circular: represents an animation that accelerates / decelerates using a circular function.
- BackBow: represents an effect that simulates a retraction in the motion of the animation. The amplitude of the retraction can be controlled through the AnimationOptions' Param property. The default param value is 1.5.
- Bounce: represents a bouncing effect animation.
- Elastic: represents an oscillating effect animation. The oscillation frequency can be controlled through the AnimationOptions' Param property. The default param value is 0.5.
The default animations can be additionally customized by an easing function, specified via EasingType enumeration:
- EaseIn: follows the animation function associated with the Animation.
- EaseOut: inverses the animation function associated with the Animation.
- EaseInOut: uses EaseIn for the first half of the Animation's duration and EaseOut for the second half.
- EaseOutIn: uses EaseOut for the first half of the Animation's duration and EaseIn for the second half.
### Custom Animation Functions
In addition to the provided default animation functions, it is also possible to define custom animation effects. Set the AnimationType property to Custom and pass a custom animation function callback to the Animation constructor. The callback signature should contain two arguments - the time progressed as a percentage from the start of the animation and the user-set parameter, used in the animation function. The following example uses a custom function where x is a value between 0 and 1 and y is a parameter, passed as an argument to the Animation constructor.
```csharp
using MindFusion.Animations;
public double Custom(double progress, double? param)
{
return Math.Pow(Math.E, 1 - (1 / Math.Pow(progress, param.Value)));
}
// ...
var animationOptions = new AnimationOptions();
animationOptions.FromValue = 5f;
animationOptions.ToValue = 100f;
animationOptions.Duration = 500;
animationOptions.Param = 5d;
animationOptions.AnimationType = AnimationType.Custom;
var animation = new Animation(node, animationOptions, null, Custom);
animation.Start();
```
## User Defined Node Shapes and Custom Drawing
The appearance of MindFusion.Diagramming items can be customized in several additional ways, as described below.
### Shape Templates
The (Markdown/T_MindFusion_Diagramming_Shape.md) class provides the means for defining complex geometric shapes, made of straight lines, arcs and Bézier curves. Such shapes can be assigned to the (Markdown/T_MindFusion_Diagramming_ShapeNode.md#shape) property of (Markdown/T_MindFusion_Diagramming_ShapeNode.md) objects, or to the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headshape) property of (Markdown/T_MindFusion_Diagramming_DiagramLink.md) objects. A shape template must always contain an outline to be used for hit testing, clipping and finding intersections with other items. Optionally, shapes can contain decoration elements and text region definitions. Decorations are visual elements that do not take part in hit testing and clipping. Text regions are the parts of shapes in which node's text is laid out and rendered. MindFusion.Diagramming provides more than 100 (#table-of-predefined-shapes) templates, which can be accessed through the (Markdown/T_MindFusion_Diagramming_Shape.md#shapes) collection or (Markdown/T_MindFusion_Diagramming_Shape.md#fromid) method of the (Markdown/T_MindFusion_Diagramming_Shape.md) class. Each predefined shape has a string identifier assigned to it. Use the (Markdown/T_MindFusion_Diagramming_Shape.md#fromid) method to find a shape with the specified id. A shape template can be assigned to the (Markdown/T_MindFusion_Diagramming_ShapeNode.md#shape) member of shape nodes.
### Dynamic Shapes
Shapes defined via (Markdown/T_MindFusion_Diagramming_ElementTemplate.md) objects are scaled proportionally to the size of nodes. If shape elements should scale non-uniformly, use the (Markdown/T_MindFusion_Diagramming_Shape.md#shape)(formula) constructor to define shapes through Visio-like formulas that take into consideration the current width and height of nodes. Another constructor takes a (Markdown/CC_T_MindFusion_Diagramming_CreatePathDelegate_0.md) parameter that can be used to define shapes via .NET functions.
A formula shape can be parameterized by adding (Markdown/T_MindFusion_Diagramming_ShapeControlPoint.md) objects to the shape's (Markdown/T_MindFusion_Diagramming_Shape.md#controlpoints) collection. The control point positions are passed as arguments to the shape scripts, where they can be used to modify the node's appearance. For example, the following code defines a rounded rectangle shape, whose corner radius can be modified by users via the control point.
```csharp
// a rounded rectangle shape, with an arc at each corner
string roundRect = @"
r = Min(Width / 2, radius.X);
MoveTo(r, 0);
LineTo(Width - r, 0);
ArcTo(Width, r, false, false, r, r);
LineTo(Width, Height - r);
ArcTo(Width - r, Height, false, false, r, r);
LineTo(r, Height);
ArcTo(0, Height - r, false, false, r, r);
LineTo(0, r);
ArcTo(r, 0, false, false, r, r);
";
var myRect = new Shape(roundRect, "MyRect");
// add a control point for the 'radius' parameter
myRect.ControlPoints.Add(new ShapeControlPoint(
"radius", 5, 1, 15, UnitType.Fixed, 0, 0, 0, UnitType.Fixed));
```
### Shape Libraries
The ShapeDesigner tool included in the MindFusion.Diagramming suite lets you draw custom shapes and store them in shape libraries. A library file can be loaded into your application using the (Markdown/T_MindFusion_Diagramming_ShapeLibrary.md) class. The definitions loaded from a shape library are automatically added to the (Markdown/T_MindFusion_Diagramming_Shape.md#shapes) collection and can be accessed through the (Markdown/T_MindFusion_Diagramming_Shape.md#fromid) method, just as the predefined shapes.
### Custom Painting
Another way to customize item's appearance is implemented by raising an event each time an item is painted, giving you the option to attach your own drawing code to the MindFusion.Diagramming's rendering engine. Use the corresponding CustomDraw property of items to enable that feature in your application.
MindFusion.Diagramming provides several options for custom drawing. If you choose (Markdown/T_MindFusion_Diagramming_CustomDraw.md) drawing style, your drawing code will be executed after the standard item drawing code is executed and (Markdown/T_MindFusion_Diagramming_ShapeNode.md#image) is rendered, but before the text is rendered. Furthermore, the Graphics object you receive to draw on has a clipping region applied that corresponds to a node's shape. If using (Markdown/T_MindFusion_Diagramming_CustomDraw.md) drawing mode, none of the standard MindFusion.Diagramming drawing code is executed - just yours. The (Markdown/T_MindFusion_Diagramming_CustomDraw.md) mode performs standard painting of items, but leaves the drawing of shadows to your code.
Place your own drawing code in a handler of the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawnode), (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawcell) and (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawlink) events. These events are fired for each custom-drawn item that needs repainting.
### Combining Custom Shapes with Custom Drawing
Finally, you could combine user-defined shapes with the (Markdown/T_MindFusion_Diagramming_CustomDraw.md) custom-painting style. Thus, you can get custom shapes enabled for a node and your custom painting code executing with the node shape used as clipping region. You might clear the clipping region, but be careful - if you draw outside node's bounding rectangle the view may not update correctly.
## Text Attributes and Formatting
### Text in Shape Nodes
A (Markdown/T_MindFusion_Diagramming_ShapeNode.md) node can display (Markdown/T_MindFusion_Diagramming_ShapeNode.md#text) within its outlines. Text position and alignment depend on the value of (Markdown/T_MindFusion_Diagramming_ShapeNode.md#textformat). The text is painted with the color set in (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush). Even more useful layout and formatting attributes can be enabled via (Markdown/T_MindFusion_Diagramming_ShapeNode.md#polygonaltextlayout) and (Markdown/T_MindFusion_Diagramming_ShapeNode.md#enablestyledtext).
### Layout Text in Arbitrary Shapes
(Markdown/T_MindFusion_Diagramming_ShapeNode.md) instances can have various shapes, as specified via their (Markdown/T_MindFusion_Diagramming_ShapeNode.md#shape) and (Markdown/T_MindFusion_Diagramming_ShapeNode.md#shapeorientation) properties. To layout text inside non-rectangular shapes, enable (Markdown/T_MindFusion_Diagramming_ShapeNode.md#polygonaltextlayout). If enabled, MindFusion.Diagramming uses a formatting algorithm that fits exactly each line of text within the width of a line inside a polygonal shape. If a shape node has curved outlines, the formatting algorithm approximates them the poly-lines.
### Supplementary Node Labels
Apart from main text content, the (Markdown/T_MindFusion_Diagramming_NodeLabel_0.md) class lets you display additional labels and pin them to node's edges or corners. Call the (Markdown/T_MindFusion_Diagramming_DiagramNode.md#addlabel) method to create such supplementary labels, and use (Markdown/T_MindFusion_Diagramming_NodeLabel_0.md) (and base (Markdown/T_MindFusion_Diagramming_ItemLabel_0.md)) properties and methods to customize their appearance and position.### Text Wrapping
If there isn't enough space available to fit a whole line of text, MindFusion.Diagramming wraps the text to a new line when it reaches the edge of the node. You can specify that the text should be wrapped only at word boundaries by setting the Trimming member of (Markdown/T_MindFusion_Diagramming_ShapeNode.md#textformat) to StringTrimming.Word. The default is to split words into multiple parts if there is not enough space to fit a whole word.If you prefer to use your own line-breaks, you can disable the automatic text wrapping by enabling the NoWrap flag in the FormatFlags member of (Markdown/T_MindFusion_Diagramming_ShapeNode.md#textformat). If automatic wrapping is disabled and there isn't enough space to fit the whole line, the text is clipped at the node boundaries.
### Text in Tables
A (Markdown/T_MindFusion_Diagramming_TableNode.md) can display text in its caption bar and inside each cell. Text in the (Markdown/T_MindFusion_Diagramming_TableNode.md#caption) is painted with (Markdown/T_MindFusion_Diagramming_TableNode.md#captionbrush) and is aligned as specified via (Markdown/T_MindFusion_Diagramming_TableNode.md#captionformat). Text in cells is painted in their own (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md#textbrush) and is aligned according to their own (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md#textformat). Even more useful formatting attributes can be enabled via (Markdown/T_MindFusion_Diagramming_TableNode.md#enablestyledtext) property.
### Styled Text
The (Markdown/T_MindFusion_Diagramming_ShapeNode.md#enablestyledtext) property of (Markdown/T_MindFusion_Diagramming_ShapeNode.md), (Markdown/T_MindFusion_Diagramming_TableNode.md) and (Markdown/T_MindFusion_Diagramming_ItemLabel_0.md) enables or disables styled text rendering. Styled text can have various attributes applied to the characters it contains. The attributes are specified using HTML-like formatting tags embedded in the raw text. Shape nodes can display styled text only if (Markdown/T_MindFusion_Diagramming_ShapeNode.md#polygonaltextlayout) is enabled. Use the (Markdown/T_MindFusion_Diagramming_Diagram.md#drawstyledtext) method to display styled text in custom-drawn items.
The following table lists the currently supported style tags:
| **Tag
** | **Description
**
| text
| Indicates italic text.
| text
| Indicates bold text.
| text
| Indicates underlined text.
| text
| Indicates subscript.
| text
| Indicates superscript.
| text
| Changes the color of the text. The red green and blue color channels are specified as two-digit hexadecimal numbers.
When styled text is enabled, you must use <, > and & to display respectively the <, > and & symbols.
### Link Labels
The (Markdown/T_MindFusion_Diagramming_DiagramLink.md#text) of a (Markdown/T_MindFusion_Diagramming_DiagramLink.md) is painted with the color specified in (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush) and is positioned as set in (Markdown/T_MindFusion_Diagramming_DiagramLink.md#textstyle). Apart from main text content, the (Markdown/T_MindFusion_Diagramming_LinkLabel.md) class lets you display additional labels and pin them to link's points or segments. Call the (Markdown/T_MindFusion_Diagramming_DiagramLink.md#addlabel) method to create such supplementary labels, and use (Markdown/T_MindFusion_Diagramming_LinkLabel.md) (and base (Markdown/T_MindFusion_Diagramming_ItemLabel_0.md)) properties and methods to customize their appearance and position. Labels can automatically avoid overlapping nodes or other labels when their (Markdown/T_MindFusion_Diagramming_LinkLabel.md#autoarrange) property is set.
### Fonts
All items provide a (Markdown/T_MindFusion_Diagramming_DiagramItem.md#font) property that allows getting or setting the font used for rendering their text. Always set the font's Unit property to World to get correct zooming of items' text and proper formatting and layout.
## Modifying the Diagram Appearance
You can customize most of the diagram visualization effects.
### Background
The (Markdown/T_MindFusion_Diagramming_Diagram.md) background area can be filled using a solid brush, gradient, texture or color patterns, by setting the (Markdown/T_MindFusion_Diagramming_Diagram.md#backbrush) property. Background theme can also be an image set by the (Markdown/T_MindFusion_Diagramming_Diagram.md#backgroundimage) property. The image can be any from the supported by the .NET System.Drawing.Image file formats - metafiles, icons, bitmaps, jpegs or gifs. Background image can be centered, aligned to a corner of the control or document, tiled or stretched to cover the drawing area - depending on the (Markdown/T_MindFusion_Diagramming_Diagram.md#backgroundimagealign) property value. It is possible to paint the area outside (Markdown/T_MindFusion_Diagramming_Diagram.md#bounds) using a distinct brush by setting the (Markdown/T_MindFusion_Diagramming_Diagram.md#exteriorbrush) property.
### Smoothing
The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#smoothingmode) property enables or disables antialiasing of lines and curves rendered in the diagram view. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#textrenderinghint) property enables or disables smoothing of text.
### Shadows
By default all diagram items have shadows drawn under them. If (Markdown/T_MindFusion_Diagramming_Diagram.md#shadowsstyle) is set to (Markdown/T_MindFusion_Diagramming_ShadowsStyle.md), the item shadows are drawn at the lowest Z-level under all items, which makes them look as on single Z-level. If it is set to (Markdown/T_MindFusion_Diagramming_ShadowsStyle.md) each shadow is drawn immediately under its corresponding item, possibly covering parts of other items, which gives more 3D-like look to the diagram. If the style is set to (Markdown/T_MindFusion_Diagramming_ShadowsStyle.md) no shadows are drawn. The shadows offset from items is specified by the (Markdown/T_MindFusion_Diagramming_Diagram.md#shadowoffsetx) and (Markdown/T_MindFusion_Diagramming_Diagram.md#shadowoffsety) properties or the (Markdown/T_MindFusion_Diagramming_Diagram.md#setshadowoffset) method. Shadows are painted using the brush specified via (Markdown/T_MindFusion_Diagramming_Diagram.md#shadowbrush).
### Selection
The style of selection handles drawn around the active item can be set with the (Markdown/T_MindFusion_Diagramming_Diagram.md#activeitemhandlesstyle) property. Items in multiple selection have their handles drawn using the style specified through the (Markdown/T_MindFusion_Diagramming_Diagram.md#selecteditemhandlesstyle) property. Disabled manipulation handles are painted using (Markdown/T_MindFusion_Diagramming_Diagram.md#disabledhandlesstyle) when (Markdown/T_MindFusion_Diagramming_Diagram.md#showdisabledhandles) is enabled (see (Markdown/T_MindFusion_Diagramming_DiagramNode.md#enabledhandles)). The (Markdown/T_MindFusion_Diagramming_Selection.md#style) property of the (Markdown/T_MindFusion_Diagramming_Selection.md) class controls the way multiple selection is displayed.
### Mouse Cursors
Different mouse cursor icons can be set to give context-sensitive feedback to users, prompting them if creation/modification of an item is possible. The following properties specify what cursors are displayed at different situations: (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#pointercursor), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#movecursor), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#disallowcursor), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#drawlinkcursor), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#allowlinkcursor), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#disallowlinkcursor), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#horizontalresizecursor), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#verticalresizecursor), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#diagonalresizecursor), (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#counterdiagonalresizecursor). MindFusion.Diagramming displays the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#pancursor) while panning the diagram view. Set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#currentcursor) if you need to change the cursor from a mouse movement related event handler.
### Grid Settings
An alignment grid is drawn if the (Markdown/T_MindFusion_Diagramming_Diagram.md#showgrid) is set to true. The (Markdown/T_MindFusion_Diagramming_Diagram.md#gridcolor) property specifies the color of grid points.
## Initial Values of Item Properties
Each new item, created either by the user or programmatically, is initialized with some kind of default property values.
If you create items by using the new operator and adding them the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#nodes) or (Markdown/T_MindFusion_Diagramming_Diagram.md#links) collection, you can initialize the items by passing a (Markdown/T_MindFusion_Diagramming_Diagram.md) reference to the respective constructor, or by passing another item to the copy constructor. In the former case, item properties are initialized from the default-property values defined in (Markdown/T_MindFusion_Diagramming_Diagram.md). In the latter case, properties are copied from the prototype item.
When users draw new items, the items are initialized from the (Markdown/T_MindFusion_Diagramming_Diagram.md) properties, but you can change the default values by handling the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#initializenode) and (Markdown/T_MindFusion_Diagramming_DiagramBase.md#initializelink) events.
Items created via the diagram's (Markdown/T_MindFusion_Diagramming_Diagram.md#factory) object are always initialized from the default-property values defined in (Markdown/T_MindFusion_Diagramming_Diagram.md).
Below are listed item properties and the corresponding constants or (Markdown/T_MindFusion_Diagramming_Diagram.md) properties through which they are initialized.
Note that some properties in the tables below are marked as styled. Styled properties usually default to null (Nothing in Visual Basic), unless the item is created through the prototype constructor, in which case the values of the styled properties are obtained from the prototype item. When a style property is null, its effective value is determined by the style associated with the item or the theme applied to the diagram. For more information on how the style system works, check (#styles-and-themes).
| **DiagramItem Property
** | **Initialized With
**
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#brush) (styled)
| null (affected by (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#brush) of the corresponding (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md))
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#locked)
| false
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#font) (styled)
| null (affected by (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#fontfamily), (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#fontsize), (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#fontstyle), and (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#fontunit) of the corresponding (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md))
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#pen) (styled)
| null (affected by (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#stroke) and (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#strokethickness) of the corresponding (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md))
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#selected)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#selectaftercreate)
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#shadowbrush) (styled)
| null (affected by (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#shadowbrush) of the corresponding (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md))
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#shadowoffsetx)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#shadowoffsetx)
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#shadowoffsety)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#shadowoffsety)
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag)
| null
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#textbrush) (styled)
| null (affected by (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#textbrush) of the corresponding (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md))
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tooltip)
| (empty string)
| (Markdown/T_MindFusion_Diagramming_DiagramItem.md#visible)
| true
| **ShapeNode Property
** | **Initialized With
**
| (Markdown/T_MindFusion_Diagramming_ShapeNode.md#customdraw)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#shapecustomdraw)
| (Markdown/T_MindFusion_Diagramming_DiagramNode.md#enabledhandles)
| (Markdown/T_MindFusion_Diagramming_AdjustmentHandles.md)
| (Markdown/T_MindFusion_Diagramming_DiagramNode.md#expandable)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#nodesexpandable)
| (Markdown/T_MindFusion_Diagramming_DiagramNode.md#handlesstyle)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#shapehandlesstyle)
| (Markdown/T_MindFusion_Diagramming_ShapeNode.md#image)
| null
| (Markdown/T_MindFusion_Diagramming_ShapeNode.md#imagealign)
| (Markdown/T_MindFusion_Drawing_ImageAlign.md)
| (Markdown/T_MindFusion_Diagramming_ShapeNode.md#text)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#shapetext)
| (Markdown/T_MindFusion_Diagramming_ShapeNode.md#textformat)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#textformat)
| (Markdown/T_MindFusion_Diagramming_ShapeNode.md#transparent)
| false
| **ContainerNode Property
** | **Initialized With
**
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#autoshrink)
| false
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#caption)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#containercaption)
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#captionbrush) (styled)
| null (affected by (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#textbrush) of the corresponding (Markdown/T_MindFusion_Diagramming_ContainerNodeStyle.md))
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#captionformat)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#textformat)
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#captionheight)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#containercaptionheight)
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#foldable)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#containersfoldable)
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#folded)
| false
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#highlightpen)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#containerhighlightpen)
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#margin)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#containermargin)
| (Markdown/T_MindFusion_Diagramming_ContainerNode.md#minimumsize)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#containerminimumsize)
| **TableNode Property
** | **Initialized With
**
| (Markdown/T_MindFusion_Diagramming_TableNode.md#caption)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tablecaption)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#captionbrush) (styled)
| null (affected by (Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md#textbrush) of the associated (Markdown/T_MindFusion_Diagramming_TableNodeStyle.md))
| (Markdown/T_MindFusion_Diagramming_TableNode.md#captionformat)
| Centered horizontal and vertical alignment
| (Markdown/T_MindFusion_Diagramming_TableNode.md#cellcustomdraw)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#cellcustomdraw)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#cellframestyle)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#cellframestyle)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#columnwidth)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tablecolumnwidth)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#customdraw)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tablecustomdraw)
| (Markdown/T_MindFusion_Diagramming_DiagramNode.md#handlesstyle)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tablehandlesstyle)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#image)
| null
| (Markdown/T_MindFusion_Diagramming_TableNode.md#imagealign)
| (Markdown/T_MindFusion_Drawing_ImageAlign.md)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#connectionstyle)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tableconnectionstyle)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#rowheight)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tablerowheight)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#scrollable)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tablesscrollable)
| (Markdown/T_MindFusion_Diagramming_TableNode.md#shape)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#tableshape)
| **DiagramLink Property
** | **Initialized With
**
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#baseshape)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkbaseshape)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#baseshapesize)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkbaseshapesize)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headshape)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkheadshape)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headshapesize)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkheadshapesize)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#autoroute)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#routelinks)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#cascadeorientation)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkcascadeorientation)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#customdraw)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkcustomdraw)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#dynamic)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#dynamiclinks)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#headpen) (styled)
| null (affected by (Markdown/T_MindFusion_Diagramming_DiagramLinkStyle.md#headstroke) and (Markdown/T_MindFusion_Diagramming_DiagramLinkStyle.md#headstrokethickness) of the associated (Markdown/T_MindFusion_Diagramming_DiagramLinkStyle.md))
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#intermediateshape)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkintermediateshape)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#intermediateshapesize)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkintermediateshapesize)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#retainform)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linksretainform)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#segmentcount)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linksegments)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#shape)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linkshape)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#text)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linktext)
| (Markdown/T_MindFusion_Diagramming_DiagramLink.md#textstyle)
| (Markdown/T_MindFusion_Diagramming_Diagram.md#linktextstyle)
## Display Graphs in 3D
The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md) control allows displaying diagrams in 3D. It could be used to display graphs with associated 3D spatial data, such as structural formulas of chemical compounds, or to display dense graphs that otherwise would look too cluttered in 2D. Look at the SpringLayout solution in the Samples folder that demonstrates how to apply a 3D (Markdown/T_MindFusion_Diagramming_Layout_SpringLayout.md) algorithm and display a 3D view of the diagram.
### Set the camera position programmatically
The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md#cameraposition) property specifies the position of the camera in 3D space. To specify the camera's pitch, roll and yaw angles, set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md#camerarotation) property. (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md#pointcamerato) lets you direct the camera to a specified point. The (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md#viewerdistance) property specifies the distance of the viewer from the camera. After changing the camera position or direction, or after changing the location of graph nodes, call the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md#resetprojection) method. It calculates the new projection coordinates of nodes and updates the view.
### Set the camera position interactively
The following mouse and keyboard actions allow moving the camera around the 3D scene:
- Mouse drag: Moves the camera across the plane perpendicular to direction of the camera.
- CTRL+mouse drag: Rotate the camera by changing the pitch and yaw angles.
- Mouse wheel: Causes moving the camera forwards or backwards.
- CTRL+mouse wheel: Rolls the camera around the Z-axis.
Set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md#enableorbitingcamera) property to true to enable using the CTRL key to move the camera in an orbit around a node.
### Coordinate system
(Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md) uses the following coordinate system:
The X axis is horizontal and points to the right.
The Y axis is vertical and points upwards.
The Z axis specifies depth and its values grow with distance.
### Edit graphs in 3D
Set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) property to a value different than (Markdown/T_MindFusion_Diagramming_Behavior.md) to allow users select and modify existing items or draw new ones. New items are drawn in a plane in front of the camera, orthogonal to the camera direction. The distance from the camera to this plane can be specified through the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md#creationplanedistance) property.
## Miscellaneous
### Associate Custom Data with Items
You can associate custom values from any data type with diagram elements by setting their (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#id) properties. If the associated data is of a value type or of type that is serializable (marked as and implementing the ISerializable interface), then it is saved and loaded together with the diagram items when the MindFusion.Diagramming diagrams are saved or loaded. The (Markdown/T_MindFusion_Diagramming_Diagram.md#findnode), (Markdown/T_MindFusion_Diagramming_Diagram.md#findlink), (Markdown/T_MindFusion_Diagramming_Diagram.md#findnodebyid) and (Markdown/T_MindFusion_Diagramming_Diagram.md#findlinkbyid) methods let you find diagram elements associated with a specific value.
### Inspecting Items Geometry
- The (Markdown/T_MindFusion_Diagramming_DiagramNode.md#intersects) method of the (Markdown/T_MindFusion_Diagramming_DiagramNode.md) class determines whether nodes intersect.
- The (Markdown/T_MindFusion_Diagramming_DiagramLink.md#intersects) method of (Markdown/T_MindFusion_Diagramming_DiagramLink.md) lets you test if links intersect other links or nodes.
- The (Markdown/T_MindFusion_Diagramming_DiagramLink.md#length) method of the (Markdown/T_MindFusion_Diagramming_DiagramLink.md) class returns the total length of a link.
- The (Markdown/T_MindFusion_Diagramming_DiagramItem.md#hittest) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#containspoint) methods let you check if an item contains specified point.
### Fluent API
Extension methods in MindFusion.Diagramming.Fluent and MindFusion.Diagramming.Layout.Fluent namespaces let you initialize objects using fluent programming style:
```csharp
using MindFusion.Diagramming.Fluent;
using MindFusion.Diagramming.Layout.Fluent;
//...
diagram.Factory
.CreateShapeNode(10, 10, 20, 20)
.Brush(Color.LightGray)
.Font("Arial", 12)
.EnableStyledText(true)
.Text("Task 1")
.ToolTip("This is the task");
new TreeLayout()
.LevelDistance(20)
.NodeDistance(20)
.LinkStyle(TreeLayoutLinkType.Cascading3)
.Arrange(diagram);
```
## MindFusion.Diagramming and Web Applications
MindFusion provides dedicated ASP.NET and ASP.NET MVC diagramming controls, which provides several output modes supporting varying degrees of interactivity. For more information, take a look at their respective web pages:
https://mindfusion.dev/netdiagram.html
https://mindfusion.dev/mvcdiagram.html
Nevertheless, you can still use the MindFusion.Diagramming Windows Forms components to render your diagrams in a browser. The (Markdown/T_MindFusion_Diagramming_Diagram.md) class defined in MindFusion.Diagramming.dll can be used to build diagrams dynamically and send them as static bitmap images to the browser. Optionally, you can create HTML image maps that let you associate hyperlinks with nodes and links in the diagram images. To implement that, follow these steps:
- Create a (Markdown/T_MindFusion_Diagramming_Diagram.md) instance and store it in the Session object.
- Use the (Markdown/T_MindFusion_Diagramming_Diagram.md) instance to programmatically construct or edit diagrams, in response to web form events.
- Create an aspx file that overrides the Page_Load event like this: setting the page ContentType to "image/jpeg", generating an image by performing (Markdown/T_MindFusion_Diagramming_Diagram.md#createimage) and returning that image to the browser by writing it into the Response.OutputStream object.
- Add a web Image control and set its URL to point the aspx page.
- Use (Markdown/T_MindFusion_Diagramming_HtmlBuilder.md) to create a client side image map that lets you associate hyperlinks and JavaScript functions with the diagram elements.
Similar implementation is demonstrated in the WebApp sample coming with MindFusion.Diagramming. To try the sample, create a virtual IIS directory for it, name the directory WebApp, then build and run the sample project.
Alternatively, you could use (Markdown/T_MindFusion_Diagramming_Export_SvgExporter.md) to create an SVG drawing of the diagram and include the generated SVG content in web pages.
## Tutorials
The tutorials in this section assume you have already added a (Markdown/T_MindFusion_Diagramming_Diagram.md) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) objects to your application as shown in the (#getting-started) topic.
## Tutorial 1: Loading graph data
This tutorial shows how to load graph data from XML and create diagram objects corresponding to the graph nodes and edges.
Right-click the project in Solution Explorer and choose Add -> New Item from the context menu. Create a new XML file called SampleGraph.xml and add to it content in the following form:
```
```
Set the file's "Build Action" property to "Content" and "Copy to Output Directory" to "Copy if newer".
Add an OnLoad override to the form:
```csharp
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
```
```
Protected Overrides Sub OnLoad(ByVal e As EventArgs)
MyBase.OnLoad(e)
End Sub
```
Add the following variables to the Loaded handler. "nodeMap" maps diagram nodes to their identifiers, and "bounds" contains the default node size.
```csharp
Dictionary nodeMap = new Dictionary();
RectangleF bounds = new RectangleF(0, 0, 18, 6);
```
```
Dim nodeMap As New Dictionary(Of String, DiagramNode)()
Dim bounds As New RectangleF(0, 0, 18, 6)
```
Load the XML document using the XML DOM API:
```csharp
// Load the graph xml
XmlDocument document = new XmlDocument();
document.Load("SampleGraph.xml");
```
```
' Load the graph xml
Dim document As New XmlDocument()
document.Load("SampleGraph.xml")
```
Load the graph node elements and create their corresponding (Markdown/T_MindFusion_Diagramming_ShapeNode.md) objects by calling the (Markdown/T_MindFusion_Diagramming_Factory.md#createshapenode) method of the (Markdown/T_MindFusion_Diagramming_Factory.md) class. (Markdown/T_MindFusion_Diagramming_Factory.md#createshapenode) is just a shortcut to creating a (Markdown/T_MindFusion_Diagramming_ShapeNode.md) instance using the "new" operator and adding it to the (Markdown/T_MindFusion_Diagramming_Diagram.md#nodes) collection of the diagram. Additionally, this code maps the new node to the "id" attribute of the XML element, and sets the node's (Markdown/T_MindFusion_Diagramming_ShapeNode.md#text) to the value of the "name" attribute.
```csharp
// Load node data
XmlNodeList nodes = document.SelectNodes("/Graph/Nodes/Node");
foreach (XmlElement node in nodes)
{
ShapeNode diagramNode = diagram.Factory.CreateShapeNode(bounds);
nodeMap = diagramNode;
diagramNode.Text = node.GetAttribute("name");
}
```
```
' Load node data
Dim nodes As XmlNodeList = document.SelectNodes("/Graph/Nodes/Node")
For Each node As XmlElement In nodes
Dim diagramNode As ShapeNode = diagram.Factory.CreateShapeNode(bounds)
nodeMap(node.GetAttribute("id")) = diagramNode
diagramNode.Text = node.GetAttribute("name")
Next
```
Load the graph links and create corresponding (Markdown/T_MindFusion_Diagramming_DiagramLink.md) objects. The (Markdown/T_MindFusion_Diagramming_DiagramLink.md#origin) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md#destination) of the links are accessed by their ids through the "nodeMap" dictionary.
```csharp
// Load link data
XmlNodeList links = document.SelectNodes("/Graph/Links/Link");
foreach (XmlElement link in links)
{
diagram.Factory.CreateDiagramLink(
nodeMap,
nodeMap);
}
```
```
' Load link data
Dim links As XmlNodeList = document.SelectNodes("/Graph/Links/Link")
For Each link As XmlElement In links
diagram.Factory.CreateDiagramLink(nodeMap(link.GetAttribute("origin")), nodeMap(link.GetAttribute("target")))
Next
```
Arrange the diagram using the (Markdown/T_MindFusion_Diagramming_Layout_LayeredLayout.md) class.
```csharp
// Arrange the graph
LayeredLayout layout = new LayeredLayout();
layout.LayerDistance = 12;
layout.Arrange(diagram);
```
```
' Arrange the graph
Dim layout As New LayeredLayout()
layout.LayerDistance = 12
layout.Arrange(diagram)
```
Build and run the project. If everything is fine, you should see this representation of the graph:
## Tutorial 2: Loading hierarchical data
This tutorial shows how to load graph data from XML and create diagram objects corresponding to the graph nodes and edges.
Right-click the project in Solution Explorer and choose Add -> New Item from the context menu. Create a new XML file called SampleTree.xml and add to it content in the following form:
```
```
Set the file's "Build Action" property to "Content" and "Copy to Output Directory" to "Copy if newer".
- Override the OnLoad method of the form:
```csharp
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
```
```
Protected Overrides Sub OnLoad(ByVal e As EventArgs)
MyBase.OnLoad(e)
End Sub
```
Add the following member to the window class to hold the default node size.
```csharp
RectangleF nodeBounds = new RectangleF(0, 0, 24, 6);
```
```
Dim nodeBounds As New RectangleF(0, 0, 24, 6)
```
Create the tree root node, and call the CreateChildren method, which builds the tree recursively.
```csharp
ShapeNode root = diagram.Factory.CreateShapeNode(nodeBounds);
root.Text = "Project";
XmlDocument document = new XmlDocument();
document.Load("SampleTree.xml");
CreateChildren(root, document.SelectSingleNode("Project"));
```
```
Dim root As ShapeNode = diagram.Factory.CreateShapeNode(nodeBounds)
root.Text = "Project"
Dim document As New XmlDocument()
document.Load("SampleTree.xml")
CreateChildren(root, document.SelectSingleNode("Project"))
```
Define CreateChildren as follows. It takes as parameters the parent (Markdown/T_MindFusion_Diagramming_DiagramNode.md) and parent XML element, iterates the child XML elements to build the next level of the hierarchy, and creates corresponding diagram items by calling (Markdown/T_MindFusion_Diagramming_Factory.md#createshapenode) and (Markdown/T_MindFusion_Diagramming_Factory.md#creatediagramlink).
```csharp
private void CreateChildren(DiagramNode parentDiagNode, XmlNode parentXmlNode)
{
foreach (XmlElement element in parentXmlNode.SelectNodes("Activity"))
{
ShapeNode node = diagram.Factory.CreateShapeNode(nodeBounds);
node.Text = element.GetAttribute("Name");
diagram.Factory.CreateDiagramLink(parentDiagNode, node);
CreateChildren(node, element);
}
}
```
```
Private Sub CreateChildren(ByVal parentDiagNode As DiagramNode, ByVal parentXmlNode As XmlNode)
For Each element As XmlElement In parentXmlNode.SelectNodes("Activity")
Dim node As ShapeNode = diagram.Factory.CreateShapeNode(nodeBounds)
node.Text = element.GetAttribute("Name")
diagram.Factory.CreateDiagramLink(parentDiagNode, node)
CreateChildren(node, element)
Next
End Sub
```
Use (Markdown/T_MindFusion_Diagramming_Layout_TreeLayout.md) to arrange the diagram. Add the following code to the end of the OnLoad override.
```csharp
TreeLayout layout = new TreeLayout();
layout.Type = TreeLayoutType.Cascading;
layout.Direction = TreeLayoutDirections.LeftToRight;
layout.LinkStyle = TreeLayoutLinkType.Cascading2;
layout.NodeDistance = 3;
layout.LevelDistance = -8; // let horizontal positions overlap
layout.Arrange(diagram);
```
```
Dim layout As New TreeLayout()
layout.Type = TreeLayoutType.Cascading
layout.Direction = TreeLayoutDirections.LeftToRight
layout.LinkStyle = TreeLayoutLinkType.Cascading2
layout.NodeDistance = 3
layout.LevelDistance = -8
' let horizontal positions overlap
layout.Arrange(diagram)
```
Build and run the project. If everything is fine, you should see this representation of the hierarchy:
## Tutorial 3: Create a Custom Node Type
This tutorial shows how to define a custom node class that inherits (Markdown/T_MindFusion_Diagramming_CompositeNode.md) and adds several new properties. It assumes you have already integrated the diagram library into your project, as shown in (#getting-started) guide. The node appearance is defined using an XML template.
1. Right-click the project in Solution Explorer and choose Add -> New Item from the context menu. Create a new XML file called OrgChartNode.xml, set its Build Action in Properties window to "Embedded resource", and add the following template code to it.
```
```
2. Add to the project a new class called OrgChartNode. Make it derive from (Markdown/T_MindFusion_Diagramming_CompositeNode.md).
```csharp
using System;
using System.Drawing;
using System.IO;
using MindFusion.Diagramming;
using MindFusion.Diagramming.Components;
using SolidBrush = MindFusion.Drawing.SolidBrush;
namespace Tutorial3
{
public class OrgChartNode : CompositeNode
{
static string xmlTemplate = LoadTemplate("Tutorial3.OrgChartNode.xml");
public OrgChartNode(Diagram diagram) : base(diagram)
{
}
ShapeComponent shapeComponent;
ImageComponent imageComponent;
TextComponent titleComponent;
TextComponent fullNameComponent;
TextComponent detailsComponent;
}
}
```
3. In the constructor, load from the XML template using (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md), and assign references to individual components using (Markdown/T_MindFusion_Diagramming_CompositeNode.md#findcomponent):
```csharp
// load components from XML template
var rootComponent = XmlLoader.Load(xmlTemplate, this, null);
if (rootComponent != null)
this.Components.Add(rootComponent);
// find components by name
shapeComponent = (ShapeComponent)FindComponent("Shape");
imageComponent = (ImageComponent)FindComponent("Image");
titleComponent = (TextComponent)FindComponent("Title");
fullNameComponent = (TextComponent)FindComponent("FullName");
detailsComponent = (TextComponent)FindComponent("Details");
// customize appearance
titleComponent.TextAlignment = StringAlignment.Near;
fullNameComponent.TextAlignment = StringAlignment.Near;
detailsComponent.TextAlignment = StringAlignment.Near;
shapeComponent.IsOutline = true;
Fill = new SolidBrush(Color.White);
Stroke = new MindFusion.Drawing.Pen(Color.Black, 0.5f);
```
4. Implement the LoadTemplate helper method to load XML text from assembly's resources:
```csharp
static string LoadTemplate(string resourcePath)
{
var assembly = typeof(OrgChartNode).Assembly;
using (var stream = assembly.GetManifestResourceStream(resourcePath))
{
if (stream == null)
{
throw new InvalidOperationException(
"Could not find embedded resource.");
}
using (var reader = new StreamReader(stream))
return reader.ReadToEnd();
}
}
```
5. Define custom properties that delegate their implementation to the components loaded from the template.
```csharp
public MindFusion.Drawing.Pen Stroke
{
get { return shapeComponent?.Pen; }
set
{
shapeComponent.Pen = value;
this.Repaint();
}
}
public MindFusion.Drawing.Brush Fill
{
get { return shapeComponent?.Brush; }
set
{
shapeComponent.Brush = value;
this.Repaint();
}
}
public Image Image
{
get { return imageComponent?.Image; }
set
{
imageComponent.Image = value;
this.Repaint();
}
}
public string Title
{
get { return titleComponent?.Text; }
set
{
titleComponent.Text = value;
this.Repaint();
}
}
public string FullName
{
get { return fullNameComponent?.Text; }
set
{
fullNameComponent.Text = value;
this.Repaint();
}
}
public string Details
{
get { return detailsComponent?.Text; }
set
{
detailsComponent.Text = value;
this.Repaint();
}
}
```
6. Double click the form in form designer to add a Load event handler:
```csharp
this.Load += new System.EventHandler(this.MainForm_Load);
...
private void MainForm_Load(object sender, EventArgs e)
{
}
```
7. Add a few instances of the OrgChartNode class:
```csharp
// create first OrgChartNode
OrgChartNode node1 = new OrgChartNode(diagram);
node1.Stroke = new MindFusion.Drawing.Pen(Color.Red, 0.5f);
node1.Bounds = new RectangleF(20, 10, 80, 35);
node1.Title = "CEO";
node1.FullName = "John Smith";
node1.Details = "Our beloved leader.\n" +
"The CEO of this great corporation.";
node1.Image = LoadImage("Tutorial3.image1.png");
diagram.Nodes.Add(node1);
// create second OrgChartNode
OrgChartNode node2 = new OrgChartNode(diagram);
node2.Bounds = new RectangleF(70, 60, 80, 35);
node2.Title = "CIO";
node2.FullName = "Bob Smith";
node2.Details = "The CIO of this great corporation.";
node2.Image = LoadImage("Tutorial3.image2.png");
diagram.Nodes.Add(node2);
// create connector
diagram.Factory.CreateDiagramLink(node1, node2);
```
8. Implement the LoadImage helper method, which loads image files (set as Embedded Resource) from assembly:
```csharp
Image LoadImage(string resourcePath)
{
var assembly = Assembly.GetExecutingAssembly();
using (var stream = assembly.GetManifestResourceStream(resourcePath))
{
if (stream == null)
return null;
return Image.FromStream(stream);
}
}
```
9. Build and run the project. You should see the custom nodes rendered like this:
## Tutorial 4: Custom Nodes Integration
In (#tutorial-3-create-a-custom-node-type), we created an OrgChartNode class derived from (Markdown/T_MindFusion_Diagramming_CompositeNode.md) that arranges child components according to an XML template and exposes custom properties such as Title, FullName, Details, and Image. This tutorial demonstrates how to fully integrate custom node classes with the core features of MindFusion.Diagramming for Windows Forms, such as serialization, undo support, creating nodes by drag-and-drop or drawing with the mouse on the canvas:
1. The (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) control provides a sidebar palette from which users can drag items directly onto a (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) canvas. In the Form Designer, drag an (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) instance to the form and set its Dock property (in our sample project it's placed inside a panel along with other UI elements):
```csharp
this.itemListView = new MindFusion.Diagramming.WinForms.ItemListView();
...
this.panelLeft.Controls.Add(this.itemListView);
...
this.itemListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.itemListView.Location = new System.Drawing.Point(0, 120);
this.itemListView.Name = "itemListView";
this.itemListView.NewInstanceSize = new System.Drawing.SizeF(80F, 35F);
this.itemListView.Size = new System.Drawing.Size(150, 280);
this.itemListView.IconSize = new Size(130, 55);
this.itemListView.MeasureUnit = MindFusion.Diagramming.MeasureUnit.Pixel;
this.itemListView.TabIndex = 4;
...
this.diagramView.AllowDrop = true;
```
In form's Load event handler, add prototype instances of OrgChartNode:
```csharp
OrgChartNode node1 = new OrgChartNode(diagram);
node1.Title = "CEO";
node1.FullName = "Type here";
node1.Details = "Chief executive officer";
node1.Image = LoadImage("Tutorial4.image1.png");
itemListView.AddItem(node1);
OrgChartNode node2 = new OrgChartNode(diagram);
node2.Title = "CIO";
node2.FullName = "Type here";
node2.Details = "Chief information officer";
node2.Image = LoadImage("Tutorial4.image2.png");
itemListView.AddItem(node2);
```
In order to allow drag-and-drop to (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md), enable its AllowDrop property. Other than that, (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) automatically handles drag-and-drop gestures without requiring extra event plumbing.
2. Add a copy constructor to the OrgChartNode class. When a user drags a node template from (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) onto the diagram, the control creates a clone of the prototype node by invoking its copy constructor. Any custom node type used in an (Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md) must provide this constructor:
```csharp
public OrgChartNode(OrgChartNode prototype) : base(prototype)
{
// find components by name
shapeComponent = (ShapeComponent)FindComponent("Shape");
imageComponent = (ImageComponent)FindComponent("Image");
titleComponent = (TextComponent)FindComponent("Title");
fullNameComponent = (TextComponent)FindComponent("FullName");
detailsComponent = (TextComponent)FindComponent("Details");
Title = prototype.Title;
FullName = prototype.FullName;
Image = prototype.Image;
Details = prototype.Details;
}
```
The copy constructor calls base(prototype) to duplicate base properties (such as bounds, tags, and hyperlink properties) and copies custom application-level fields to the new instance.
Under the hood, the dragged node is cloned by calling the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#clone) method of (Markdown/T_MindFusion_Diagramming_DiagramItem.md), whose base implementation invokes the copy constructor via reflection. Alternatively, you could override the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#clone) method directly; however, providing a copy constructor is generally recommended, as it is often useful for programmatic copying elsewhere in your application.
3. In order to enable drawing OrgChartNodes with the mouse, set the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#customnodetype) property of (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) to the type of your node, and set (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#behavior) to (Markdown/T_MindFusion_Diagramming_Behavior.md). Otherwise, drawing on the diagram canvas creates standard (Markdown/T_MindFusion_Diagramming_ShapeNode.md) instances by default.
// enable drawing OrgChartNodes with the mouse
diagramView.CustomNodeType = typeof(OrgChartNode);
diagramView.Behavior = Behavior.Custom;
When drawing nodes interactively with the mouse, you can subscribe to the diagram's (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodecreated) event to provide default values or placeholder images:
```csharp
void diagramView_NodeCreated(object sender, NodeEventArgs e)
{
var node = e.Node as OrgChartNode;
if (node != null && node.Image == null)
{
node.Image = LoadImage("Tutorial4.image1.png");
node.Title = "new node";
node.FullName = "new node";
node.Details = "new node";
}
}
```
4. To save and load diagrams containing custom nodes to and from XML, you must register the custom class and implement serialization methods for its custom properties. Register the custom class with (Markdown/T_MindFusion_Diagramming_Diagram.md#registeritemclass), providing a unique XML tag identifier and class version number:
```csharp
Diagram.RegisterItemClass(typeof(OrgChartNode), "my:OrgChartNode", 1);
```
In OrgChartNode.cs, override (Markdown/T_MindFusion_Diagramming_DiagramItem.md#savetoxml) and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#loadfromxml) using (Markdown/T_MindFusion_Diagramming_XmlPersistContext.md) helper methods:
```csharp
protected override void SaveToXml(XmlElement xmlElement, XmlPersistContext context)
{
base.SaveToXml(xmlElement, context);
context.WriteString(Title, "Title", xmlElement);
context.WriteString(FullName, "FullName", xmlElement);
context.WriteImage(Image, "Image", xmlElement);
context.WriteString(Details, "Details", xmlElement);
}
protected override void LoadFromXml(XmlElement xmlElement, XmlPersistContext context)
{
base.LoadFromXml(xmlElement, context);
Title = context.ReadString("Title", xmlElement);
FullName = context.ReadString("FullName", xmlElement);
Image = context.ReadImage("Image", xmlElement);
Details = context.ReadString("Details", xmlElement);
}
protected override bool SerializeComponents()
{
return false;
}
```
Note: Overriding (Markdown/T_MindFusion_Diagramming_CompositeNode.md#serializecomponents) to return false prevents the base (Markdown/T_MindFusion_Diagramming_CompositeNode.md) from writing out each internal layout component. Instead, OrgChartNode recreates them from its embedded XML layout template when instantiated, and loads only the data properties from the diagram XML.
Now you can serialize the diagram to XML as shown below:
```csharp
void btnSave_Click(object sender, EventArgs e)
{
var dlg = new SaveFileDialog();
dlg.DefaultExt = "xml";
dlg.Filter = "XML files|*.xml";
if (dlg.ShowDialog() == DialogResult.OK)
diagram.SaveToXml(dlg.FileName);
}
void btnLoad_Click(object sender, EventArgs e)
{
var dlg = new OpenFileDialog();
dlg.DefaultExt = "xml";
dlg.Filter = "XML files|*.xml";
if (dlg.ShowDialog() == DialogResult.OK)
diagram.LoadFromXml(dlg.FileName);
}
```
5. Undo and Redo Support: The diagramming library uses a memento-based undo architecture. When an action occurs, the diagram saves state snapshots using properties classes derived from (Markdown/T_MindFusion_Diagramming_DiagramItemProperties.md). Define a properties class that inherits from (Markdown/T_MindFusion_Diagramming_DiagramNodeProperties.md) and holds the custom state of your node:
```csharp
public class OrgChartNodeProperties : DiagramNodeProperties
{
internal string Title;
internal string FullName;
internal Image Image;
internal string Details;
}
```
Override (Markdown/T_MindFusion_Diagramming_DiagramItem.md#createproperties), (Markdown/T_MindFusion_Diagramming_DiagramItem.md#saveproperties), and (Markdown/T_MindFusion_Diagramming_DiagramItem.md#restoreproperties) in OrgChartNode:
```csharp
protected override DiagramItemProperties CreateProperties()
{
return new OrgChartNodeProperties();
}
protected override void SaveProperties(DiagramItemProperties props)
{
base.SaveProperties(props);
var state = (OrgChartNodeProperties)props;
state.Title = Title;
state.FullName = FullName;
state.Image = Image;
state.Details = Details;
}
protected override void RestoreProperties(DiagramItemProperties props)
{
base.RestoreProperties(props);
var state = (OrgChartNodeProperties)props;
Title = state.Title;
FullName = state.FullName;
Image = state.Image;
Details = state.Details;
}
```
Enable undo tracking on the diagram:
```csharp
diagram.UndoManager.UndoEnabled = true;
```
You can now wire UI buttons to the (Markdown/T_MindFusion_Diagramming_UndoManager.md) methods:
```csharp
void btnUndo_Click(object sender, EventArgs e)
{
diagram.UndoManager.Undo();
}
private void btnRedo_Click(object sender, EventArgs e)
{
diagram.UndoManager.Redo();
}
```
The full source code for this tutorial is available in the Samples/Tutorial4 subfolder of the library's installation folder.
## Reference
The following reference gives detailed description of all classes exposed by the MindFusion.Diagramming component with their properties and methods.
The most important classes in the package are (Markdown/T_MindFusion_Diagramming_Diagram.md) and (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md), representing respectively the model and view in the MVC design pattern. (Markdown/T_MindFusion_Diagramming_ShapeNode.md), (Markdown/T_MindFusion_Diagramming_TableNode.md) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md) classes represent items that can be placed in the diagram - namely geometric shapes, tables and links. These classes are derived from a base class (Markdown/T_MindFusion_Diagramming_DiagramItem.md) that defines their most common functionality. Item groups are instances of the (Markdown/T_MindFusion_Diagramming_Group.md) class. Various events can be fired when users modify the contents of a diagram.
Below are listed the namespaces contained in the MindFusion.Diagramming package:
| **Namespace
** | **Description
**
| (#mindfusiondiagramming)
|
| (#mindfusiondiagrammingcommands)
|
| (#mindfusiondiagrammingexport)
|
| (#mindfusiondiagrammingimport)
|
| (#mindfusiondiagramminglanes)
|
| (#mindfusiondiagramminglayout)
|
| (#mindfusiondiagrammingwinforms)
|
| (#mindfusiondiagrammingwinformsbehaviors)
|
| (#mindfusiondrawing)
|
| (#mindfusiondrawingdesign)
|
| (#mindfusiontoolsshapedesignerctrl)
|
If you have any additional questions, well, you know - support@mindfusion.eu or (+359) 88 951 737. We are always there for you.
## Table of Predefined Shapes
| **Shape
** | **Identifier
** | **Common Uses
**
|
| Actor
| A user
An actor in use case model
|
| Alternative
| An alternative in SDL
An extraction in flowcharts
Storage in quality management
|
| Arrow1
| Use as desired
|
| Arrow2
| Use as desired
|
| Arrow3
| Transportation in quality management
A reference point
|
| Arrow4
| Use as desired
|
| Arrow5
| Use as desired
|
| Arrow6
| Use as desired
|
| Arrow7
| A signal
Electronic transmission of data
|
| Arrow8
| Use as desired
|
| Arrow9
| Use as desired
|
| BeginLoop
| Begin of a loop
|
| BpmnComplex
| BPMN Gateways: Complex Decision/Merge
|
| BpmnDataBasedXor
| BPMN Gateways: Data-Based Exclusive Decision/Merge (XOR)
|
| BpmnEndCancel
| BPMN Events: Cancel (End)
|
| BpmnEndCompensation
| BPMN Events: Compensation (End)
|
| BpmnEndError
| BPMN Events: Error (End)
|
| BpmnEndLink
| BPMN Events: Link (End)
|
| BpmnEndMessage
| BPMN Events: Message (End)
|
| BpmnEndMultiple
| BPMN Events: Multiple (End)
|
| BpmnEndTerminate
| BPMN Events: Terminate (End)
|
| BpmnEventBasedXor
| BPMN Gateways: Event-Based Exclusive Decision/Merge (XOR)
|
| BpmnInclusive
| BPMN Gateways: Inclusive Decision/Merge (OR)
|
| BpmnIntermediateCancel
| BPMN Events: Cancel (Intermediate)
|
| BpmnIntermediateCompensation
| BPMN Events: Compensation (Intermediate)
|
| BpmnIntermediateError
| BPMN Events: Error (Intermediate)
|
| BpmnIntermediateLink
| BPMN Events: Link (Intermediate)
|
| BpmnIntermediateMessage
| BPMN Events: Message (Intermediate)
|
| BpmnIntermediateMultiple
| BPMN Events: Multiple (Intermediate)
|
| BpmnIntermediateRule
| BPMN Events: Rule (Intermediate)
|
| BpmnIntermediateTimer
| BPMN Events: Timer (Intermediate)
|
| BpmnParallelFork
| BPMN Gateways: Parallel Fork/Join (AND)
|
| BpmnStartLink
| BPMN Events: Link (Start)
|
| BpmnStartMessage
| BPMN Events: Message (Start)
|
| BpmnStartMultiple
| BPMN Events: Multiple (Start)
|
| BpmnStartRule
| BPMN Events: Rule (Start)
|
| BpmnStartTimer
| BPMN Events: Timer (Start)
|
| Cloud
| Object instance in data flow diagrams
|
| Collate
| A collation in flowcharts
|
| ConeDown
| Use as desired
|
| ConeUp
| Use as desired
|
| ConnectedIssues
| Connected issues in quality management
|
| CreateRequest
| Request to create in SDL
|
| Cross
| Use as desired
|
| Cube
| Use as desired
|
| Cylinder
| Use as desired
|
| Database
| A database in flowcharts
|
| DataTransmition
| Electronic transmission of data
|
| DDelay
| Use as desired
|
| Decagon
| Use as desired
|
| Decision
| Decision in flowcharts
A comparison in flowcharts
Relationship in data flow diagrams
|
| Decision2
| A decision in SDL
|
| Delay
| A delay in process diagrams
|
| DInDelay
| Use as desired
|
| DirectAccessStorage
| A direct access storage
|
| DiskStorage
| Data stored on disk in flowcharts
|
| Display
| Data that is displayed for human use
|
| DividedEvent
| An event
|
| DividedProcess
| A process or document in flowcharts
Entity in data flow diagrams
|
| Document
| A document
|
| Donut
| Use as desired
|
| DOutDelay
| Use as desired
|
| Ellipse
| A cross-reference within the same page of a flowchart
Process in data flow diagrams
State in data flow diagrams
A continuation of the flowchart in SDL
An use case
Operation in quality management
|
| EndLoop
| End of a loop
|
| ExternalOrganization
| An external organization
|
| ExternalProcess
| An external process
|
| File
| A file
|
| FramedRectangle
| Use as desired
|
| Gate
| A gateway
|
| Heart
| Use as desired
|
| Heptagon
| Use as desired
|
| Hourglass
| Use as desired
|
| Input
| Data that is input by manual means
|
| InternalStorage
| An internal storage
|
| Interrupt
| An interrupt
|
| Interrupt2
| An interrupt
|
| IsoProcess
| Iso9000 process
|
| Junction
| A summing junction
A return in SDL
|
| Lightning
| Use as desired
|
| LinedDocument
| A document in flowcharts
|
| ManualOperation
| Operation performed by a human
|
| Merge
| A merger in flowcharts
Inbound goods in quality management
Non-electronic file
Stop state in data flow diagrams
|
| MessageFromUser
| A message from user side in SDL
|
| MessageToUser
| A message to user side in SDL
|
| Microform
| A microform
|
| MicroformProcessing
| A microform processing
|
| MicroformRecording
| A microform recording
|
| MultiDocument
| A multiple document in flowcharts
|
| MultiProc
| A multiple process or document in flowcharts
|
| Octagon
| Use as desired
|
| OfflineStorage
| An offline storage
|
| OffpageConnection
| A cross-reference to another page of a flowchart
|
| OffpageReference
| A cross-reference to another page of a flowchart
A foreign module
|
| Or
| An 'or' statement
|
| Pentagon
| Use as desired
|
| Plaque
| Use as desired
|
| PrimitiveFromCall
| A primitive from call control in SDL
|
| PrimitiveToCall
| A primitive to call control in SDL
|
| Procedure
| Procedure in SDL
|
| Process
| A process or document in flowcharts
A file or data storage
|
| Prysm
| Use as desired
|
| PunchedCard
| A punched card
|
| PyramidDown
| Use as desired
|
| PyramidUp
| Use as desired
|
| Rectangle
| A metric operation
'External interactor' in data flow diagrams
Inspection in quality management
|
| RightTriangle
| Use as desired
|
| RoundRect
| A process or item in flowcharts
An event
An issue in quality management
|
| RSave
| Input or output data in flowcharts
|
| Save
| A save in SDL
Input or output data in flowcharts
|
| Sort
| A sort operation
|
| Sphere
| Use as desired
|
| Star
| Use as desired
|
| Star4Pointed
| Use as desired
|
| Star5Pointed
| Use as desired
|
| Star6Pointed
| Use as desired
|
| Star7Pointed
| Use as desired
|
| Star16Pointed
| Use as desired
|
| Star24Pointed
| Use as desired
|
| Star32Pointed
| Use as desired
|
| Start
| Start of a program flow
A starting point in SDL
|
| Tape
| Sequentially accessible data
|
| Terminator
| Start or end of a program flow
|
| TransmittalTape
| A transmittal tape
|
| Trapezoid
| Use as desired
## Online Resources
### Video Tutorials
- Getting started with the diagram control
### Blog Posts
- Logic Model Software Application - a Demo
- Ticket Booking System
- Formula shapes with adjustable parameters in Flowchart.NET
- Combine layout algorithms I
- Combine layout algorithms II
- Combine layout algorithms III
- Create a Dialogue Editor using MindFusion Diagram
- Visualize graph algorithms using MindFusion Diagram component
- Database schema diagram
- ContainerNode fold / unfold animations
- Display Petri nets using MindFusion diagram component
- Create a musical score writer using MindFusion diagram component
## Technical Support
Detailed information about everything connected with software products offered by MindFusion - online documentation, demos, information about forthcoming products can be found at https://mindfusion.dev. The site is updated every day, so make sure you visit it regularly to catch up with the newest from us.
Apart from that, MindFusion employs a dedicated and technically proficient support team. This guarantees that all your questions and inquiries will be answered in quick and professional manner. They can be reached by e-mail at support@mindfusion.eu or by phone at +359 889 199 729.
You can post a question on the MindFusion.Diagramming discussion board here:
https://mindfusion.dev/Forum/YaBB.pl?board=fcnet_disc
or visit our Help Desk site:
https://mindfusion.dev/HelpDesk/index.php
We will be happy to hear any suggestions and recommendations you might have regarding MindFusion.Diagramming. We do take in account the opinion of every single person who has shown interest in our products.
## MindFusion Products
MindFusion offers various programming components for different platforms. Below is a list of our products with links to their sections on our website as well link to download a trial version. Clients that have already purchased a product use an increasing discount for each subsequent one.
| **Diagramming
** | **Links
**
| Diagramming for WPF
| Product Information
Download
| Diagramming for WinForms
| Product Information
Download
| Diagramming for Java Swing
| Product Information
Download
| Diagramming for JavaScript
| Product Information
Download
| Diagramming for ASP.NET
| Product Information
Download
| Diagramming for ASP.NET MVC
| Product Information
Download
| Diagramming for Xamarin
| Product Information
Download
| Diagramming for UWP
| Product Information
Download
| Diagramming for Android
| Product Information
Download
| DiagramViewer for iOS/Cocoa Touch
| Product Information
Download
| Diagramming for ActiveX
| Product Information
Download
| Diagramming for Silverlight
| Product Information
Download
| **Charting
** | **Links
**
| Charting for WPF
| Product Information
Download
| Charting for WinForms
| Product Information
Download
| Charting for Java Swing
| Product Information
Download
| Charting for JavaScript
| Product Information
Download
| Charting for ASP.NET
| Product Information
Download
| Charting for Xamarin
| Product Information
Download
| Charting for Android
| Product Information
Download
| Charting for Silverlight
| Product Information
Download
| **Scheduling
** | **Links
**
| Scheduling for WPF
| Product Information
Download
| Scheduling for WinForms
| Product Information
Download
| Scheduling for Java Swing
| Product Information
Download
| Scheduling for JavaScript
| Product Information
Download
| Scheduling for ASP.NET
| Product Information
Download
| Scheduling for Xamarin
| Product Information
Download
| Scheduling for Silverlight
| Product Information
Download
| **Spreadsheet
** | **Links
**
| Spreadsheet for WPF
| Product Information
Download
| Spreadsheet for WinForms
| Product Information
Download
| Spreadsheet for Java Swing
| Product Information
Download
| **Reporting
** | **Links
**
| Reporting for WPF
| Product Information
Download
| Reporting for WinForms
| Product Information
Download
| Reporting for Silverlight
| Product Information
Download
| **Virtual Keyboard
** | **Links
**
| Virtual Keyboard for WPF
| Product Information
Download
| Virtual Keyboard for WinForms
| Product Information
Download
| Virtual Keyboard for Java Swing
| Product Information
Download
| Virtual Keyboard for JavaScript
| Product Information
Download
| **Mapping
** | **Links
**
| Mapping for WPF
| Product Information
Download
| Mapping for WinForms
| Product Information
Download
| Mapping for ASP.NET
| Product Information
Download
| Mapping for Silverlight
| Product Information
Download
| **Suites
** | **Links
**
| Pack for WPF
| Product Information
Download
| Pack for WinForms
| Product Information
Download
| Pack for Java Swing
| Product Information
Download
| Pack for JavaScript
| Product Information
Download
| Pack for ASP.NET
| Product Information
Download
| Pack for Xamarin
| Product Information
Download
| Pack for Silverlight
| Product Information
Download
| Pack for Diagramming
| Product Information
Download
| Pack for Scheduling
| Product Information
Download
## Acknowledgements
Our thanks to:
- Joe Stegman, who permitted us to use his PNGEncoder class in the MindFusion.Diagramming implementation.
- Jon Harris, who permitted us to port his PQTree Java code for the MindFusion.GraphLib implementation.
- Nader Alkhatib, who contributed his LogicGates project as a sample for the MindFusion.Diagramming package.
- Mark James for the Silk icon set (http://www.famfamfam.com/lab/icons/silk/)
- ic#code for their #ziplib, used for implementing some custom MSI actions in MindFusion setup kits.
# Section 2: API Class Reference
The following are links to the consolidated class reference guides. Each file contains all constructors, fields, properties, methods, and events for that class.
### Namespace MindFusion.Common.WinForms
- [Accordion Class](Markdown/T_MindFusion_Common_WinForms_Accordion.md): A container control that displays a stack of collapsible panes.
- [AccordionItem Class](Markdown/T_MindFusion_Common_WinForms_AccordionItem.md): Represents an item in an (Markdown/T_MindFusion_Common_WinForms_Accordion.md) control.
- [IZoomTarget Interface](Markdown/T_MindFusion_Common_WinForms_IZoomTarget.md): Specifies the capabilities required by (Markdown/T_MindFusion_Common_WinForms_ZoomControl.md) from its target controls.
- [ScrollArrowEventArgs Class](Markdown/T_MindFusion_Common_WinForms_ScrollArrowEventArgs.md): Contains arguments for the (Markdown/T_MindFusion_Common_WinForms_ZoomControl.md#scrollarrowclicked) event.
- [ScrollDirection Enumeration](Markdown/T_MindFusion_Common_WinForms_ScrollDirection.md): Identifies the direction of a scroll arrow.
- [TickPosition Enumeration](Markdown/T_MindFusion_Common_WinForms_TickPosition.md): Specifies the position of trackbar ticks.
- [TouchControl Class](Markdown/T_MindFusion_Common_WinForms_TouchControl.md): A multi-touch aware control.
- [TouchEventArgs Class](Markdown/T_MindFusion_Common_WinForms_TouchEventArgs.md): Contains the arguments passed to touch event handlers.
- [ZoomControl Class](Markdown/T_MindFusion_Common_WinForms_ZoomControl.md): (Markdown/T_MindFusion_Common_WinForms_ZoomControl.md) lets users zoom and pan a target component interactively.
### Namespace MindFusion.Diagramming
- [Action Enumeration](Markdown/T_MindFusion_Diagramming_Action.md): Defines values that identify the possible actions a user can carry out on diagram items.
- [AdjustmentHandle Class](Markdown/T_MindFusion_Diagramming_AdjustmentHandle.md): Represents an adjustment handle used to move or modify diagram items.
- [AdjustmentHandles Enumeration](Markdown/T_MindFusion_Diagramming_AdjustmentHandles.md): Identifies the distinct selection handles of a node.
- [AeroEffect Class](Markdown/T_MindFusion_Diagramming_AeroEffect.md): Represents an effect that adds semitransparency to the node and emphasizes its outline by adding a shade and an inner stroke.
- [Anchoring Enumeration](Markdown/T_MindFusion_Diagramming_Anchoring.md): Defines values that specify how automatic layout algorithms align links to anchor points.
- [AnchorPattern Class](Markdown/T_MindFusion_Diagramming_AnchorPattern.md): Represents a set of anchor points, which specify the exact locations where links are allowed to connect to nodes.
- [AnchorPoint Class](Markdown/T_MindFusion_Diagramming_AnchorPoint.md): Specify the locations in a node, to which the user is allowed to connect links.
- [AnchorPointCollection Class](Markdown/T_MindFusion_Diagramming_AnchorPointCollection.md): Represents a strongly typed collection of anchor points.
- [AnchorPointEventArgs Class](Markdown/T_MindFusion_Diagramming_AnchorPointEventArgs.md): Contains the arguments passed to the anchor point-related events, such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#originanchorchanged) and (Markdown/T_MindFusion_Diagramming_DiagramBase.m...
- [ArcTemplate Class](Markdown/T_MindFusion_Diagramming_ArcTemplate.md): Represents an arc in a shape definition.
- [AreaEventArgs Class](Markdown/T_MindFusion_Diagramming_AreaEventArgs.md): Contains arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_HtmlBuilder.md#creatingarea) event of the (Markdown/T_MindFusion_Diagramming_HtmlBuilder.md) class.
- [ArrowHeads Class](Markdown/T_MindFusion_Diagramming_ArrowHeads.md): Contains predefined arrowhead shapes.
- [AttachTo Enumeration](Markdown/T_MindFusion_Diagramming_AttachTo.md): Specifies the type of attachment in a group.
- [AttachToLink Enumeration](Markdown/T_MindFusion_Diagramming_AttachToLink.md): Defines values specifying the possible ways to attach a node to a link.
- [AttachToNode Enumeration](Markdown/T_MindFusion_Diagramming_AttachToNode.md): Defines values specifying the possible ways to attach a node to another node.
- [AutoJson Class](Markdown/T_MindFusion_Diagramming_AutoJson.md): Apply the (Markdown/T_MindFusion_Diagramming_AutoJson.md) attribute to a property of a (Markdown/T_MindFusion_Diagramming_CompositeNode.md)-derived class to indicate that it should be included in J...
- [AutoResize Enumeration](Markdown/T_MindFusion_Diagramming_AutoResize.md): Defines in which directions automatic resizing can enlarge the diagram scrollable area.
- [Axis Enumeration](Markdown/T_MindFusion_Diagramming_Axis.md): Specifies a coordinate axis.
- [BarcodeNode Class](Markdown/T_MindFusion_Diagramming_BarcodeNode.md): Represents nodes that can encode and render barcodes.
- [BarcodeNodeProperties Class](Markdown/T_MindFusion_Diagramming_BarcodeNodeProperties.md): Stores the values of (Markdown/T_MindFusion_Diagramming_BarcodeNode.md) properties during undo / redo operations. If you need to implement undo support for the additional properties defined by a cl...
- [BarcodeNodeStyle Class](Markdown/T_MindFusion_Diagramming_BarcodeNodeStyle.md): Represents a reusable set of properties that define the appearance of barcode nodes.
- [Behavior Enumeration](Markdown/T_MindFusion_Diagramming_Behavior.md): Defines values that specify how the component responds to actions performed by the user.
- [BezierTemplate Class](Markdown/T_MindFusion_Diagramming_BezierTemplate.md): Represents a Bézier curve in a shape definition.
- [BinarySerializer Interface](Markdown/T_MindFusion_Diagramming_BinarySerializer.md): Defines an interface for custom serialization of (Markdown/T_MindFusion_Diagramming_DiagramItem.md#tag) objects.
- [BranchIndicator Enumeration](Markdown/T_MindFusion_Diagramming_BranchIndicator.md): Defines values that indicate how to mark link branching points.
- [CellEventArgs Class](Markdown/T_MindFusion_Diagramming_CellEventArgs.md): Contains the arguments passed to event handlers, such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#cellclicked).
- [CellFrameStyle Enumeration](Markdown/T_MindFusion_Diagramming_CellFrameStyle.md): Specifies the style of the cells' frame lines.
- [CellValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_CellValidationEventArgs.md): Contains the arguments passed to event handlers, such as CellTextEditing.
- [ClipboardEventArgs Class](Markdown/T_MindFusion_Diagramming_ClipboardEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#requestclipboard) event handlers.
- [CollectionBase(T) Class](Markdown/T_MindFusion_Diagramming_CollectionBase.md): An implementation of the IList interface.
- [ColumnStyle Enumeration](Markdown/T_MindFusion_Diagramming_ColumnStyle.md): Specifies how table columns' width is set.
- [CommandHistory Class](Markdown/T_MindFusion_Diagramming_CommandHistory.md): Maintains a queue of (Markdown/T_MindFusion_Diagramming_Commands_Command.md) records used to undo or redo actions.
- [CompositeNode Class](Markdown/T_MindFusion_Diagramming_CompositeNode.md): (Markdown/T_MindFusion_Diagramming_CompositeNode.md) implements nodes whose appearance can be defined via composition of components and layout containers.
- [CompositeNodeStyle Class](Markdown/T_MindFusion_Diagramming_CompositeNodeStyle.md): Represents a reusable set of properties that define the appearance of composite nodes.
- [CompositeRouter Class](Markdown/T_MindFusion_Diagramming_CompositeRouter.md): Implements a chain of link routers (objects implementing (Markdown/T_MindFusion_Diagramming_ILinkRouter.md) interface) so that a link passes through the sequence until it gets routed successfully.
- [ConnectionPoint Class](Markdown/T_MindFusion_Diagramming_ConnectionPoint.md): This class represents a connection between an edge and a node in a graph. It decouples the (Markdown/T_MindFusion_Diagramming_DiagramLink.md) class from the (Markdown/T_MindFusion_Diagramming_Diagr...
- [Constants Class](Markdown/T_MindFusion_Diagramming_Constants.md): Contains various global constants, also provides measure unit independent constants.
- [ContainerChildEventArgs Class](Markdown/T_MindFusion_Diagramming_ContainerChildEventArgs.md): Contains arguments passed to events related to container children.
- [ContainerNode Class](Markdown/T_MindFusion_Diagramming_ContainerNode.md): Represents a diagram node that can contain other nodes.
- [ContainerNodeProperties Class](Markdown/T_MindFusion_Diagramming_ContainerNodeProperties.md): Stores the values of (Markdown/T_MindFusion_Diagramming_ContainerNode.md) properties during undo / redo operations.
- [ContainerNodeStyle Class](Markdown/T_MindFusion_Diagramming_ContainerNodeStyle.md): Represents a reusable set of properties that define the appearance of container nodes.
- [ContainerPage Class](Markdown/T_MindFusion_Diagramming_ContainerPage.md): Represents a page in a (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md).
- [ContainmentKeys Enumeration](Markdown/T_MindFusion_Diagramming_ContainmentKeys.md): For internal use.
- [ControlMouseAction Enumeration](Markdown/T_MindFusion_Diagramming_ControlMouseAction.md): Specifies available ways to handle mouse clicks on .NET controls hosted in a (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md).
- [ControlPointEventArgs Class](Markdown/T_MindFusion_Diagramming_ControlPointEventArgs.md): Contains arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#shapemodified) event.
- [Converter Class](Markdown/T_MindFusion_Diagramming_Converter.md): Provides capabilities to convert various types to and from strings in a culture-independent way.
- [CreatePathDelegate Delegate](Markdown/CC_T_MindFusion_Diagramming_CreatePathDelegate_0.md): Specifies the signature of callback functions used to generate dynamic node shapes.
- [CursorHint Enumeration](Markdown/T_MindFusion_Diagramming_CursorHint.md): Specifies what mouse cursor to display while a user interacts with the diagram.
- [CustomDraw Enumeration](Markdown/T_MindFusion_Diagramming_CustomDraw.md): Specifies what kind of custom painting to perform on diagram elements.
- [DelKeyAction Enumeration](Markdown/T_MindFusion_Diagramming_DelKeyAction.md): Specifies the type of action performed when the user presses the DEL key.
- [DevFlags Class](Markdown/T_MindFusion_Diagramming_DevFlags.md): For internal use.
- [Diagram Class](Markdown/T_MindFusion_Diagramming_Diagram.md): Represents a flow diagram.
- [DiagramBase Class](Markdown/T_MindFusion_Diagramming_DiagramBase.md): The base class of the (Markdown/T_MindFusion_Diagramming_Diagram.md) and (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) classes.
- [DiagramDocument Class](Markdown/T_MindFusion_Diagramming_DiagramDocument.md): Represents a collection of diagram pages.
- [DiagramEventArgs Class](Markdown/T_MindFusion_Diagramming_DiagramEventArgs.md): Contains the arguments passed to event handlers, such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#clicked) and (Markdown/T_MindFusion_Diagramming_DiagramBase.md#doubleclicked).
- [DiagramItem Class](Markdown/T_MindFusion_Diagramming_DiagramItem.md): Represents an item in the diagram document. All classes representing diagram elements derive from (Markdown/T_MindFusion_Diagramming_DiagramItem.md).
- [DiagramItemCollection Class](Markdown/T_MindFusion_Diagramming_DiagramItemCollection.md): Represents a strongly typed collection of (Markdown/T_MindFusion_Diagramming_DiagramItem.md) objects.
- [DiagramItemProperties Class](Markdown/T_MindFusion_Diagramming_DiagramItemProperties.md): The base type for classes that store diagram item properties during undo / redo operations.
- [DiagramItemState Class](Markdown/T_MindFusion_Diagramming_DiagramItemState.md): Contains a snapshot of the internal state of a diagram item. Instances of this class are used to store the state of items for later undo or redo operations.
- [DiagramItemStyle Class](Markdown/T_MindFusion_Diagramming_DiagramItemStyle.md): Represents a reusable set of properties that define the appearance of diagram items.
- [DiagramLink Class](Markdown/T_MindFusion_Diagramming_DiagramLink.md): Represents a link between two diagram nodes.
- [DiagramLinkCollection Class](Markdown/T_MindFusion_Diagramming_DiagramLinkCollection.md): Represents a strongly typed collection of (Markdown/T_MindFusion_Diagramming_DiagramLink.md) objects.
- [DiagramLinkProperties Class](Markdown/T_MindFusion_Diagramming_DiagramLinkProperties.md): Stores the values of (Markdown/T_MindFusion_Diagramming_DiagramLink.md) properties during undo / redo operations.
- [DiagramLinkState Class](Markdown/T_MindFusion_Diagramming_DiagramLinkState.md): Contains a snapshot of the internal state of a (Markdown/T_MindFusion_Diagramming_DiagramLink.md).
- [DiagramLinkStyle Class](Markdown/T_MindFusion_Diagramming_DiagramLinkStyle.md): Represents a reusable set of properties that define the appearance of diagram links.
- [DiagramNode Class](Markdown/T_MindFusion_Diagramming_DiagramNode.md): Represents a diagram node.
- [DiagramNodeCollection Class](Markdown/T_MindFusion_Diagramming_DiagramNodeCollection.md): Represents a strongly typed collection of diagram nodes.
- [DiagramNodeProperties Class](Markdown/T_MindFusion_Diagramming_DiagramNodeProperties.md): The base class for classes that store the properties for a DiagramNode-derived items during undo / redo operations.
- [DiagramNodeState Class](Markdown/T_MindFusion_Diagramming_DiagramNodeState.md): Contains a snapshot of the internal state of a (Markdown/T_MindFusion_Diagramming_DiagramNode.md).
- [DiagramNodeStyle Class](Markdown/T_MindFusion_Diagramming_DiagramNodeStyle.md): Represents a reusable set of properties that define the appearance of diagram nodes.
- [DiagramPage Class](Markdown/T_MindFusion_Diagramming_DiagramPage.md): Represents a single page in a (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) object.
- [DiagramPageEventArgs Class](Markdown/T_MindFusion_Diagramming_DiagramPageEventArgs.md): Contains the arguments passed to (Markdown/T_MindFusion_Diagramming_DiagramPage.md)-related event handlers.
- [DiagramPageValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_DiagramPageValidationEventArgs.md): Contains the arguments passed to handlers of (Markdown/T_MindFusion_Diagramming_DiagramPage.md) validation events.
- [DiagramStyle Class](Markdown/T_MindFusion_Diagramming_DiagramStyle.md): Represents a reusable set of properties that define the appearance of diagrams.
- [DirectionConstraint Enumeration](Markdown/T_MindFusion_Diagramming_DirectionConstraint.md): Defines values that specify in what direction to constrain node movement.
- [DraggedItem Class](Markdown/T_MindFusion_Diagramming_DraggedNode.md): Class used to hold the DiagramNode instance during drag and drop. It is used for easier detection of the dragged content as DragEventArgs.Data.GetData does not check super classes.
- [DraggedShape Class](Markdown/T_MindFusion_Diagramming_DraggedShape.md): Contains drag-and-drop information for a shape being dragged from (Markdown/T_MindFusion_Diagramming_WinForms_ShapeToolBar.md) and (Markdown/T_MindFusion_Diagramming_WinForms_ShapeListBox.md).
- [DragIndicator Enumeration](Markdown/T_MindFusion_Diagramming_DragIndicator.md): Specifies what kind of feedback to display during drag-and-drop from NodeListView.
- [DrawAnchorPointEventArgs Class](Markdown/T_MindFusion_Diagramming_DrawAnchorPointEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawanchorpoint) event handlers.
- [DrawBranchIndicatorEventArgs Class](Markdown/T_MindFusion_Diagramming_DrawBranchIndicatorEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawbranchindicator) event handlers.
- [DrawCellEventArgs Class](Markdown/T_MindFusion_Diagramming_DrawCellEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawcell) event handlers.
- [DrawItemEventArgs Class](Markdown/T_MindFusion_Diagramming_DrawItemEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawadjustmenthandles) event handlers.
- [DrawLinkEventArgs Class](Markdown/T_MindFusion_Diagramming_DrawLinkEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawlink) event handlers.
- [DrawNodeEventArgs Class](Markdown/T_MindFusion_Diagramming_DrawNodeEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#drawnode) event handlers.
- [DummyNode Class](Markdown/T_MindFusion_Diagramming_DummyNode.md): Represents virtual nodes used for disconnected links.
- [EditCellTextEventArgs Class](Markdown/T_MindFusion_Diagramming_EditCellTextEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#celltextedited) event handlers.
- [EditLinkTextEventArgs Class](Markdown/T_MindFusion_Diagramming_EditLinkTextEventArgs.md): Contains the arguments passed to the EditLinkTextEventHandler event handlers.
- [EditNodeTextEventArgs Class](Markdown/T_MindFusion_Diagramming_EditNodeTextEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#nodetextedited) event handlers.
- [EffectsProvider Class](Markdown/T_MindFusion_Diagramming_EffectsProvider.md): Provides smooth shadow and emboss effects for MindFusion.Diagramming nodes.
- [ElementTemplate Class](Markdown/T_MindFusion_Diagramming_ElementTemplate.md): Represents an element of a shape definition. This is the parent class of specific element types, such as (Markdown/T_MindFusion_Diagramming_ArcTemplate.md), (Markdown/T_MindFusion_Diagramming_LineT...
- [EmbossEffect Class](Markdown/T_MindFusion_Diagramming_EmbossEffect.md): Represents an emboss effect.
- [ExpandButtonAction Enumeration](Markdown/T_MindFusion_Diagramming_ExpandButtonAction.md): Specifies what action is triggered by the [±] buttons that are displayed near expandable nodes.
- [ExpandButtonPosition Enumeration](Markdown/T_MindFusion_Diagramming_ExpandButtonPosition.md): Defines values that specify possible locations for expand/collapse buttons.
- [ExpandIconRenderer Class](Markdown/T_MindFusion_Diagramming_ExpandIconRenderer.md): Draws expand and collapse buttons of (Markdown/T_MindFusion_Diagramming_DiagramNode.md#expandable) nodes.
- [Factory Class](Markdown/T_MindFusion_Diagramming_Factory.md): Provides shortcut methods for creating and adding instances of the standard MindFusion.Diagramming item types. Call the class methods through the (Markdown/T_MindFusion_Diagramming_Diagram.md#facto...
- [FitSize Enumeration](Markdown/T_MindFusion_Diagramming_FitSize.md): Specifies how the (Markdown/T_MindFusion_Diagramming_ShapeNode.md#resizetofittext) method should resize a node.
- [FoldIconRenderer Class](Markdown/T_MindFusion_Diagramming_FoldIconRenderer.md): Draws fold and unfold buttons in (Markdown/T_MindFusion_Diagramming_ContainerNode.md) caption bar.
- [FreeFormHandle Class](Markdown/T_MindFusion_Diagramming_FreeFormHandle.md): Represents an adjustment handle used to modify the outline of a (Markdown/T_MindFusion_Diagramming_FreeFormNode.md).
- [FreeFormNode Class](Markdown/T_MindFusion_Diagramming_FreeFormNode.md): A (Markdown/T_MindFusion_Diagramming_FreeFormNode.md) collects all points from users' mouse or touch input and displays them as node's outline.
- [FreeFormNodeStyle Class](Markdown/T_MindFusion_Diagramming_FreeFormNodeStyle.md): Represents a reusable set of properties that define the appearance of free-form nodes.
- [GlassEffect Class](Markdown/T_MindFusion_Diagramming_GlassEffect.md): Represents a glass-like visual effect.
- [GlassEffectType Enumeration](Markdown/T_MindFusion_Diagramming_GlassEffectType.md): Specifies the type of a (Markdown/T_MindFusion_Diagramming_GlassEffect.md) node effect.
- [Granularity Enumeration](Markdown/T_MindFusion_Diagramming_Granularity.md): Specifies the granularity of the obstacles map generated by (Markdown/T_MindFusion_Diagramming_QuickRouter.md).
- [GridRouter Class](Markdown/T_MindFusion_Diagramming_GridRouter.md): Implements a link routing algorithm that uses a grid to represent the free and occupied regions in the diagram.
- [GridStyle Enumeration](Markdown/T_MindFusion_Diagramming_GridStyle.md): Defines values that specify the visual style of the alignment grid.
- [Group Class](Markdown/T_MindFusion_Diagramming_Group.md): Represents a group of items in the diagram document.
- [Group.Attachment Class](Markdown/T_MindFusion_Diagramming_Group+Attachment.md): Encapsulates attachment information.
- [GroupAnchorStyles Enumeration](Markdown/T_MindFusion_Diagramming_GroupAnchorStyles.md): Specifies the master node edges to which a subordinate node can be anchored.
- [GroupCollection Class](Markdown/T_MindFusion_Diagramming_GroupCollection.md): Represents a strongly typed collection of (Markdown/T_MindFusion_Diagramming_Group.md) objects.
- [GroupEventArgs Class](Markdown/T_MindFusion_Diagramming_GroupEventArgs.md): Contains the arguments passed to handlers of group-related events, such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#groupdestroyed).
- [GroupRotation Enumeration](Markdown/T_MindFusion_Diagramming_GroupRotation.md): Defines values that indicate how rotation of a group's master node affects the nodes attached to that group.
- [HandlesStyle Enumeration](Markdown/T_MindFusion_Diagramming_HandlesStyle.md): Enumerates possible visual styles for frames that are drawn around selected nodes.
- [HandlesVisualStyle Class](Markdown/T_MindFusion_Diagramming_HandlesVisualStyle.md): Defines the (Markdown/T_MindFusion_Drawing_Pen.md) and (Markdown/T_MindFusion_Drawing_Brush.md) objects used to draw items' adjustment handles.
- [HitTestEventArgs Class](Markdown/T_MindFusion_Diagramming_HitTestEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#hittestadjustmenthandles) event handlers.
- [HitTestPriority Enumeration](Markdown/T_MindFusion_Diagramming_HitTestPriority.md): Defines values that specify the order of item hit-testing.
- [HitTestResult Enumeration](Markdown/T_MindFusion_Diagramming_HitTestResult.md): Represents the return value from a hit test.
- [HtmlBuilder Class](Markdown/T_MindFusion_Diagramming_HtmlBuilder.md): Provides methods to create and use HTML client side image maps.
- [HyperLinkStyle Enumeration](Markdown/T_MindFusion_Diagramming_HyperLinkStyle.md): Specifies how various export components should treat the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#hyperlink) property of items.
- [IDiagramView Interface](Markdown/T_MindFusion_Diagramming_IDiagramView.md): Controls that display (Markdown/T_MindFusion_Diagramming_Diagram.md) objects must implement this interface to provide screen resolution information to drawing methods.
- [IEffectsProvider Interface](Markdown/T_MindFusion_Diagramming_IEffectsProvider.md): Visual effects provider.
- [IItemFactory Interface](Markdown/T_MindFusion_Diagramming_IItemFactory.md): Defines an interface for constructing (Markdown/T_MindFusion_Diagramming_IPersists.md) objects.
- [ILinkRouter Interface](Markdown/T_MindFusion_Diagramming_ILinkRouter.md): Defines methods that should be implemented by a link-router component. The control calls them when a new link path should be set in response to changes in the diagram, such as adding or modifying n...
- [IMeasureUnitConverter Interface](Markdown/T_MindFusion_Diagramming_IMeasureUnitConverter.md): Provides means to convert between cross-type measure units.
- [InplaceEditable Interface](Markdown/T_MindFusion_Diagramming_InplaceEditable.md): Represents an in-place editable object.
- [InplaceEditableList Interface](Markdown/T_MindFusion_Diagramming_InplaceEditableList.md): Represents an object that can be edited via an inplace list control.
- [InstantiateItemEventArgs Class](Markdown/T_MindFusion_Diagramming_InstantiateItemEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_IItemFactory.md#instantiateitem) event handlers.
- [InteractionState Class](Markdown/T_MindFusion_Diagramming_InteractionState.md): Encapsulates the current state of user interaction with the control.
- [InternalUtils Class](Markdown/T_MindFusion_Diagramming_InternalUtils.md): Contains common helper methods, specific to MindFusion.Diagramming.
- [IPersists Interface](Markdown/T_MindFusion_Diagramming_IPersists.md): Base interface for serializable MindFusion.Diagramming objects.
- [IProperty Interface](Markdown/T_MindFusion_Diagramming_IProperty.md): Represents a property that can have an undefined value.
- [IResolution Interface](Markdown/T_MindFusion_Diagramming_IResolution.md): Provides information about device resolution.
- [ItemCollectionBase(T) Class](Markdown/T_MindFusion_Diagramming_ItemCollectionBase.md): A base collection class for the diagram item collections.
- [ItemEventArgs Class](Markdown/T_MindFusion_Diagramming_ItemEventArgs.md): Contains the arguments passed to item instantiation event handlers.
- [ItemLabel Class](Markdown/T_MindFusion_Diagramming_ItemLabel_0.md): The base class for node and link labels.
- [JsonPersistContext Class](Markdown/T_MindFusion_Diagramming_JsonPersistContext.md): Contains methods that can help you serialize and deserialize MindFusion.Diagramming items to and from JSON.
- [JsonSerializeTagEventArgs Class](Markdown/T_MindFusion_Diagramming_JsonSerializeTagEventArgs.md): Contains the arguments passed to the JsonSerializeTag and JsonDeserializeTag event handlers.
- [Key Enumeration](Markdown/T_MindFusion_Diagramming_Key.md): A copy of the System.Windows.Forms.Key enumeration used to propagate input information to manipulators and components.
- [Layer Class](Markdown/T_MindFusion_Diagramming_Layer.md): Represents a layer in a (Markdown/T_MindFusion_Diagramming_Diagram.md) object.
- [LayerEventArgs Class](Markdown/T_MindFusion_Diagramming_LayerEventArgs.md): Contains the arguments passed to the LayerVisibilityChanged event handler.
- [LineTemplate Class](Markdown/T_MindFusion_Diagramming_LineTemplate.md): Represents a line segment in a shape definition.
- [LinkAdjustmentHandle Class](Markdown/T_MindFusion_Diagramming_LinkAdjustmentHandle.md): Represents an adjustment handle used to modify the position of a link's control point.
- [LinkCrossingEventArgs Class](Markdown/T_MindFusion_Diagramming_LinkCrossingEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#validatelinkcrossing) event handler.
- [LinkCrossings Enumeration](Markdown/T_MindFusion_Diagramming_LinkCrossings.md): Defines values that indicate how to render link intersection points.
- [LinkEventArgs Class](Markdown/T_MindFusion_Diagramming_LinkEventArgs.md): Contains the arguments passed to handlers of link related events, such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linkcreated) and (Markdown/T_MindFusion_Diagramming_DiagramBase.md#linkde...
- [LinkLabel Class](Markdown/T_MindFusion_Diagramming_LinkLabel.md): Represents a supplementary label displayed by a (Markdown/T_MindFusion_Diagramming_DiagramLink.md). New labels can be added to a link by calling the (Markdown/T_MindFusion_Diagramming_DiagramLink.m...
- [LinkShape Enumeration](Markdown/T_MindFusion_Diagramming_LinkStyle.md): Specifies available styles for the segments of links.
- [LinkShapeEventArgs Class](Markdown/T_MindFusion_Diagramming_LinkShapeEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#setselfloopshape) event handler.
- [LinkTextStyle Enumeration](Markdown/T_MindFusion_Diagramming_LinkTextStyle.md): Specifies the position and alignment of links' labels.
- [LinkValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_LinkValidationEventArgs.md): Contains the arguments passed to handlers of link validation events.
- [ListItemEventArgs Class](Markdown/T_MindFusion_Diagramming_ListItemEventArgs.md): Defines the arguments provided to ItemListView event handlers.
- [ListNodeEventArgs Class](Markdown/T_MindFusion_Diagramming_DiagramNodeEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_WinForms_NodeListView.md#nodeselected) and (Markdown/T_MindFusion_Diagramming_WinForms_NodeListView.md#noderemoved) event han...
- [MapContent Class](Markdown/T_MindFusion_Diagramming_MapContent.md): Represents the content of a map file.
- [MapNode Class](Markdown/T_MindFusion_Diagramming_MapNode.md): Represents nodes that can render geographical maps.
- [MapNodeProperties Class](Markdown/T_MindFusion_Diagramming_MapNodeProperties.md): Stores the values of (Markdown/T_MindFusion_Diagramming_MapNode.md) properties during undo / redo operations. If you need to implement undo support for the additional properties defined by a class ...
- [MarkStyle Enumeration](Markdown/T_MindFusion_Diagramming_MarkStyle.md): Specifies the visual style of anchor point marks.
- [MeasureUnit Class](Markdown/T_MindFusion_Diagramming_MeasureUnit.md): Represents a unit of measure.
- [MeasureUnitType Enumeration](Markdown/T_MindFusion_Diagramming_MeasureUnitType.md): Specifies the type of a unit of measure.
- [ModificationEffect Enumeration](Markdown/T_MindFusion_Diagramming_ModificationEffect.md): Specifies the visual effect to apply during interactive modification of items.
- [ModificationStart Enumeration](Markdown/T_MindFusion_Diagramming_ModificationStart.md): Specifies how the user can start modifying an item.
- [ModifierKeyAction Enumeration](Markdown/T_MindFusion_Diagramming_ModifierKeyAction.md): Defines the actions that can be assigned to a modifier key such as CTRL or ALT.
- [MouseButton Enumeration](Markdown/T_MindFusion_Diagramming_MouseButton.md): Specifies constants that define which mouse button was pressed.
- [MouseButtonActions Enumeration](Markdown/T_MindFusion_Diagramming_MouseButtonActions.md): Specifies what actions can be associated with the middle and right mouse buttons.
- [MouseWheelAction Enumeration](Markdown/T_MindFusion_Diagramming_MouseWheelAction_0.md): Specifies the type of action performed when the user rotates the mouse wheel.
- [NodeAdjustmentHandle Class](Markdown/T_MindFusion_Diagramming_NodeAdjustmentHandle.md): Represents an adjustment handle used to move, resize or rotate a node.
- [NodeConstraints Class](Markdown/T_MindFusion_Diagramming_NodeConstraints.md): Defines specific constraints that can be applied to the size and location of nodes.
- [NodeEffect Class](Markdown/T_MindFusion_Diagramming_NodeEffect.md): Represents the base class of all visual effects that can be applied to the nodes in a Diagram.
- [NodeEventArgs Class](Markdown/T_MindFusion_Diagramming_NodeEventArgs.md): Contains the arguments passed to handlers of node-related events, such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#treecollapsed) and (Markdown/T_MindFusion_Diagramming_DiagramBase.md#tree...
- [NodeHandleType Enumeration](Markdown/T_MindFusion_Diagramming_NodeHandleType.md): Identifies the types of selection handles of a node.
- [NodeLabel Class](Markdown/T_MindFusion_Diagramming_NodeLabel_0.md): Represents a supplementary label displayed by a (Markdown/T_MindFusion_Diagramming_DiagramNode.md). New labels can be added to a node by calling its (Markdown/T_MindFusion_Diagramming_DiagramNode.m...
- [NodeValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_NodeValidationEventArgs.md): Contains the arguments passed to handlers of node validation events.
- [NotATreeException Class](Markdown/T_MindFusion_Diagramming_NotATreeException.md): An exception raised by the (Markdown/T_MindFusion_Diagramming_TreeEnumerator.md) class if the specified node does not represent a root of a tree.
- [NotifyCollectionChangedAction Enumeration](Markdown/T_MindFusion_Diagramming_Components_NotifyCollectionChangedAction.md): Describes the action that caused a (Markdown/T_MindFusion_Diagramming_Components_ObservableCollection.md#collectionchanged) event.
- [NotifyCollectionChangedEventArgs(T) Class](Markdown/T_MindFusion_Diagramming_Components_NotifyCollectionChangedEventArgs.md): Provides data for the (Markdown/T_MindFusion_Diagramming_Components_ObservableCollection.md#collectionchanged) event.
- [ObservableCollection(T) Class](Markdown/T_MindFusion_Diagramming_Components_ObservableCollection.md): Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed.
- [Orientation Enumeration](Markdown/T_MindFusion_Diagramming_Orientation.md): Defines values that specify the orientation of the first segment of cascading links.
- [PagedContainerNode Class](Markdown/T_MindFusion_Diagramming_PagedContainerNode.md): A container that can arrange its children in pages.
- [PageIconRenderer Class](Markdown/T_MindFusion_Diagramming_PageIconRenderer.md): Draws page navigation arrows in (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md) caption bar.
- [Path Class](Markdown/T_MindFusion_Diagramming_Path.md): Represents a sequence of connected (Markdown/T_MindFusion_Diagramming_DiagramNode.md) and (Markdown/T_MindFusion_Diagramming_DiagramLink.md) elements.
- [PathCollection Class](Markdown/T_MindFusion_Diagramming_PathCollection.md): Represents a strongly typed collection of (Markdown/T_MindFusion_Diagramming_Path.md) objects.
- [PathFinder Class](Markdown/T_MindFusion_Diagramming_PathFinder.md): Provides methods that help you find paths and cycles in a graph.
- [PatternRouter Class](Markdown/T_MindFusion_Diagramming_PatternRouter.md): Routes links by applying patterns of segment and turn sequences and accepting them when resulting paths do not cross nodes.
- [PersistableCollection(T) Class](Markdown/T_MindFusion_Diagramming_PersistableCollection.md): A base collection class for persistable collections.
- [PersistContext Class](Markdown/T_MindFusion_Diagramming_PersistContext.md): Contains methods that help serializing and deserializing complex MindFusion.Diagramming object to and from binary streams.
- [PointCollection Class](Markdown/T_MindFusion_Diagramming_PointCollection.md): Represents a strongly typed collection of points.
- [PolylineRouting Enumeration](Markdown/T_MindFusion_Diagramming_PolylineRouting.md): Defines values that indicate how Polyline links should be routed.
- [QuickRouter Class](Markdown/T_MindFusion_Diagramming_QuickRouter.md): Implements a very fast link routing algorithm that uses a tree to represent the free and occupied regions in the diagram.
- [ReadOnlyCollection(T) Class](Markdown/T_MindFusion_Diagramming_ReadOnlyCollection.md): Represents a read-only wrapper of a collection.
- [ReadOnlyDiagramItemCollection Class](Markdown/T_MindFusion_Diagramming_ReadOnlyDiagramItemCollection.md): Represents a read-only collection of items.
- [ReadOnlyDiagramLinkCollection Class](Markdown/T_MindFusion_Diagramming_ReadOnlyDiagramLinkCollection.md): Represents a read-only collection of links.
- [ReadOnlyDiagramNodeCollection Class](Markdown/T_MindFusion_Diagramming_ReadOnlyDiagramNodeCollection.md): Represents a read-only collection of nodes.
- [RectangleFConverter Class](Markdown/T_MindFusion_Diagramming_RectangleFConverter.md): Converts from RectangleF to other data types.
- [Relationship Enumeration](Markdown/T_MindFusion_Diagramming_Relationship.md): Specifies the type of relationship between two tables.
- [RelativeToLink Enumeration](Markdown/T_MindFusion_Diagramming_RelativeToLink.md): Specifies how the link labels are positioned.
- [RelativeToNode Enumeration](Markdown/T_MindFusion_Diagramming_RelativeToNode_0.md): Specifies how the node labels are positioned.
- [RenderCallback(T) Delegate](Markdown/T_MindFusion_Diagramming_RenderCallback.md): This delegate declares the prototype of drawing callbacks called by various icon (Markdown/T_MindFusion_Diagramming_Renderers.md).
- [Renderers Class](Markdown/T_MindFusion_Diagramming_Renderers.md): This class lets you set icons for shared diagram elements such as expand / collapse and fold / unfold buttons, or provide callbacks that draws them using System.Drawing (GDI+) code.
- [RenderOptions Class](Markdown/T_MindFusion_Diagramming_RenderOptions.md): Provides properties that allow customization of various aspects of printing and print-preview.
- [RenderTarget Enumeration](Markdown/T_MindFusion_Diagramming_RenderTarget.md): Specifies where the diagram is being rendered.
- [RepaintEventArgs Class](Markdown/T_MindFusion_Diagramming_RepaintEventArgs.md): Specifies the coordinates of the area that should be repainted by views when the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#repaint) event is raised.
- [RerouteLinks Enumeration](Markdown/T_MindFusion_Diagramming_RerouteLinks.md): Provides values indicating in what circumstances links must be rerouted automatically.
- [RestrictToBounds Enumeration](Markdown/T_MindFusion_Diagramming_RestrictToBounds.md): Specifies a restriction of the position of items relatively to the diagram bounds.
- [RoundRectangleTemplate Class](Markdown/T_MindFusion_Diagramming_RoundRectangleTemplate.md): Represents an (Markdown/T_MindFusion_Diagramming_ElementTemplate.md) that draws round rectangle. This class ensures that the round corners do not change during resizing which is visually better. Th...
- [RoutePattern Class](Markdown/T_MindFusion_Diagramming_RoutePattern.md): Represents a template from which routes are created.
- [RouteStep Class](Markdown/T_MindFusion_Diagramming_RouteStep.md): Represents segments or turns in routing patterns.
- [RouteStepKind Enumeration](Markdown/T_MindFusion_Diagramming_RouteStepKind.md): Represents parts of a route template.
- [RoutingOptions Class](Markdown/T_MindFusion_Diagramming_RoutingOptions.md): Allows customization of various aspects of the link routing algorithm.
- [RowEventArgs Class](Markdown/T_MindFusion_Diagramming_RowEventArgs.md): Contains the arguments passed to handlers of table row-related events, such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#tablesectioncollapsed) and (Markdown/T_MindFusion_Diagramming_Diagra...
- [SaveToStringFormat Enumeration](Markdown/T_MindFusion_Diagramming_SaveToStringFormat.md): Specifies in what format to save the diagram when generating a string using the (Markdown/T_MindFusion_Diagramming_Diagram.md#savetostring) method.
- [ScriptHelper Class](Markdown/T_MindFusion_Diagramming_ScriptHelper.md): Allows calling some static MindFusion.Diagramming methods from JavaScript and VBScript. It seems the script languages do not allow calling class static methods, so a (Markdown/T_MindFusion_Diagramm...
- [Scrollable Interface](Markdown/T_MindFusion_Diagramming_Scrollable.md): Interface used by scrollbars to interact with their containing nodes.
- [ScrollIconRenderer Class](Markdown/T_MindFusion_Diagramming_ScrollIconRenderer.md): Draws scroll arrows in (Markdown/T_MindFusion_Diagramming_TableNode.md) caption bar.
- [SegmentAdjustmentHandle Class](Markdown/T_MindFusion_Diagramming_SegmentAdjustmentHandle.md): Represents an adjustment handle used to modify the position of a link's segment.
- [Selection Class](Markdown/T_MindFusion_Diagramming_Selection.md): Represents a set of items selected in the diagram document.
- [SelectionCopy Class](Markdown/T_MindFusion_Diagramming_SelectionCopy.md): Used internally in the implementation of copy/paste functions.
- [SelectionEventArgs Class](Markdown/T_MindFusion_Diagramming_SelectionEventArgs_0.md): Contains the arguments passed to the SelectionModified event handler.
- [SelectionStyle Enumeration](Markdown/T_MindFusion_Diagramming_SelectionStyle.md): Defines values that specify how multiple selected items are indicated visually.
- [SelectionValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_SelectionValidationEventArgs.md): Contains the arguments passed to the SelectionModifying event handler.
- [SerializeTagEventArgs Class](Markdown/T_MindFusion_Diagramming_SerializeTagEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#serializetag) and (Markdown/T_MindFusion_Diagramming_DiagramBase.md#deserializetag) event handlers.
- [ShadowsStyle Enumeration](Markdown/T_MindFusion_Diagramming_ShadowsStyle.md): Enumerates possible shadows-drawing styles.
- [Shape Class](Markdown/T_MindFusion_Diagramming_Shape.md): An instance of this class represents a shape defined through a series of arc, line and Bézier segments. The segments can be a part of the shape outline, in which case they define the part of the sh...
- [ShapeAdjustmentHandle Class](Markdown/T_MindFusion_Diagramming_ShapeAdjustmentHandle.md): Represents an adjustment handle used to modify the (Markdown/T_MindFusion_Diagramming_ShapeNode.md#shape) of a (Markdown/T_MindFusion_Diagramming_ShapeNode.md).
- [ShapeCollection Class](Markdown/T_MindFusion_Diagramming_ShapeCollection.md): Represents a read-only collection of shapes.
- [ShapeControlPoint Class](Markdown/T_MindFusion_Diagramming_ShapeControlPoint.md): Represents a control point that can be used to adjust the shape of a (Markdown/T_MindFusion_Diagramming_ShapeNode.md). Control point positions are passed as parameters to shape formulas, whose code...
- [ShapeConverter Class](Markdown/T_MindFusion_Diagramming_ShapeConverter.md): Converts from (Markdown/T_MindFusion_Diagramming_Shape.md) to other data types.
- [ShapeData Class](Markdown/T_MindFusion_Diagramming_ShapeData.md): Contains the cached coordinates of the key points of a shape when the shape is applied to a specific (Markdown/T_MindFusion_Diagramming_ShapeNode.md). This class also stores additional data passed ...
- [ShapeDecoration Class](Markdown/T_MindFusion_Diagramming_ShapeDecoration.md): Defines decoration elements that are displayed as filled shapes.
- [ShapeEventArgs Class](Markdown/T_MindFusion_Diagramming_ShapeEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_WinForms_ShapeListBox.md#shapeselected) and (Markdown/T_MindFusion_Diagramming_WinForms_ShapeListBox.md#shaperenamed) event h...
- [ShapeFormulaParam Class](Markdown/T_MindFusion_Diagramming_ShapeFormulaParam.md): Represents the position of a (Markdown/T_MindFusion_Diagramming_ShapeControlPoint.md), passed as parameter to shape formulas.
- [ShapeLibrary Class](Markdown/T_MindFusion_Diagramming_ShapeLibrary.md): The (Markdown/T_MindFusion_Diagramming_ShapeLibrary.md) class represents a collection of shape definitions stored together.
- [ShapeNode Class](Markdown/T_MindFusion_Diagramming_ShapeNode.md): (Markdown/T_MindFusion_Diagramming_ShapeNode.md) instances are diagram nodes that represent geometric shapes.
- [ShapeNodeProperties Class](Markdown/T_MindFusion_Diagramming_ShapeNodeProperties.md): Stores the values of (Markdown/T_MindFusion_Diagramming_ShapeNode.md) properties during undo / redo operations.
- [ShapeNodeState Class](Markdown/T_MindFusion_Diagramming_ShapeNodeState.md): Contains a snapshot of the internal state of a (Markdown/T_MindFusion_Diagramming_ShapeNode.md). Instances of this class are used to store the state of nodes for later undo or redo operations. If y...
- [ShapeNodeStyle Class](Markdown/T_MindFusion_Diagramming_ShapeNodeStyle.md): Represents a reusable set of properties that define the appearance of shape nodes.
- [Shapes Class](Markdown/T_MindFusion_Diagramming_Shapes.md): Provides alternative method of access to the MindFusion.Diagramming (#table-of-predefined-shapes), that allows code completion and IntelliSense support, which is not available when using (Markdown/...
- [ShowAnchors Enumeration](Markdown/T_MindFusion_Diagramming_ShowAnchors.md): Specifies when anchors points should be displayed.
- [SimpleShape Enumeration](Markdown/T_MindFusion_Diagramming_SimpleShape.md): Defines the possible values for (Markdown/T_MindFusion_Diagramming_TableNode.md#shape) property of tables.
- [SizeFConverter Class](Markdown/T_MindFusion_Diagramming_SizeFConverter.md): Converts from SizeF to other data types.
- [SmoothShadowEffect Class](Markdown/T_MindFusion_Diagramming_SmoothShadowEffect.md): Represents an effect that smooths the shadow of nodes. This effect does nothing if shadows are not visible.
- [SnapToAnchor Enumeration](Markdown/T_MindFusion_Diagramming_SnapToAnchor.md): Specifies when link ends are snapped to nearest anchor points.
- [Style Class](Markdown/T_MindFusion_Diagramming_Style.md): Represents an unordered dynamic collection of properties that can be identified by name.
- [StylePropertyChangedEventArgs Class](Markdown/T_MindFusion_Diagramming_StylePropertyChangedEventArgs.md): Contains the arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_Style.md#propertychanged) event.
- [SvgNode Class](Markdown/T_MindFusion_Diagramming_SvgNode.md): Represents nodes that can render SVG drawings.
- [SvgNodeProperties Class](Markdown/T_MindFusion_Diagramming_SvgNodeProperties.md): Stores the values of (Markdown/T_MindFusion_Diagramming_SvgNode.md) properties during undo / redo operations. If you need to implement undo support for the additional properties defined by a class ...
- [SvgNodeStyle Class](Markdown/T_MindFusion_Diagramming_SvgNodeStyle.md): Represents a reusable set of properties that define the appearance of SVG nodes.
- [TableConnectionStyle Enumeration](Markdown/T_MindFusion_Diagramming_TableConnectionStyle.md): Specifies the possible values for the (Markdown/T_MindFusion_Diagramming_TableNode.md#connectionstyle) property of tables.
- [TableNode Class](Markdown/T_MindFusion_Diagramming_TableNode.md): Tables are diagram nodes that can contain multiple cells and can be related to other nodes through their rows.
- [TableNode.Cell Class](Markdown/T_MindFusion_Diagramming_TableNode+Cell.md): Represents a cell in a (Markdown/T_MindFusion_Diagramming_TableNode.md) instance.
- [TableNode.CellCollection Class](Markdown/T_MindFusion_Diagramming_TableNode+CellCollection.md): Represents a strongly-typed collection of (Markdown/T_MindFusion_Diagramming_TableNode+Cell.md) objects.
- [TableNode.Column Class](Markdown/T_MindFusion_Diagramming_TableNode+Column.md): Represents a column of a (Markdown/T_MindFusion_Diagramming_TableNode.md).
- [TableNode.ColumnCollection Class](Markdown/T_MindFusion_Diagramming_TableNode+ColumnCollection.md): Represents a strongly-typed collection of (Markdown/T_MindFusion_Diagramming_TableNode+Column.md) objects.
- [TableNode.Row Class](Markdown/T_MindFusion_Diagramming_TableNode+Row.md): Represents a row in (Markdown/T_MindFusion_Diagramming_TableNode.md) node.
- [TableNode.RowCollection Class](Markdown/T_MindFusion_Diagramming_TableNode+RowCollection.md): Represents a strongly-typed collection of (Markdown/T_MindFusion_Diagramming_TableNode+Row.md) objects.
- [TableNodeProperties Class](Markdown/T_MindFusion_Diagramming_TableNodeProperties.md): Stores the values of (Markdown/T_MindFusion_Diagramming_TableNode.md) properties during undo / redo operations.
- [TableNodeStyle Class](Markdown/T_MindFusion_Diagramming_TableNodeStyle.md): Represents a reusable set of properties that define the appearance of table nodes.
- [TableScrollUI Enumeration](Markdown/T_MindFusion_Diagramming_TableScrollUI.md): Identifies types of scroll UI supported by TableNode.
- [Theme Class](Markdown/T_MindFusion_Diagramming_Theme.md): Represents a set of (Markdown/T_MindFusion_Diagramming_Style.md) objects for different diagram item types.
- [Thickness Structure](Markdown/T_MindFusion_Diagramming_Thickness.md): Describes the thickness of a rectangular frame.
- [ThicknessConverter Class](Markdown/T_MindFusion_Diagramming_ThicknessConverter.md): The TypeConverter of the (Markdown/T_MindFusion_Diagramming_Thickness.md) structure.
- [TimerEventArgs Class](Markdown/T_MindFusion_Diagramming_TimerEventArgs.md): Contains the arguments passed to timer-related event handlers.
- [TimerEventArgs.TimerCommand Enumeration](Markdown/T_MindFusion_Diagramming_TimerEventArgs+TimerCommand.md):
- [TreeEnumerator Class](Markdown/T_MindFusion_Diagramming_TreeEnumerator.md): Enables an easy standard method to iterate over the elements of a tree-like structure of objects.
- [TreeItemEventArgs Class](Markdown/T_MindFusion_Diagramming_TreeItemEventArgs.md): Contains the arguments passed to handlers of (Markdown/T_MindFusion_Diagramming_TreeViewItem.md)-related events.
- [TreeItemValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_TreeItemValidationEventArgs.md): Contains the arguments passed to event handlers, such as (Markdown/T_MindFusion_Diagramming_DiagramBase.md#treeitemtextediting).
- [TreeViewConnectionPoint Class](Markdown/T_MindFusion_Diagramming_TreeViewConnectionPoint.md): Represents a connection between a link and a (Markdown/T_MindFusion_Diagramming_TreeViewNode.md).
- [TreeViewConnectionStyle Enumeration](Markdown/T_MindFusion_Diagramming_TreeViewConnectionStyle.md): Specifies the possible values for the (Markdown/T_MindFusion_Diagramming_TreeViewNode.md#connectionstyle) property of (Markdown/T_MindFusion_Diagramming_TreeViewNode.md) objects.
- [TreeViewItem Class](Markdown/T_MindFusion_Diagramming_TreeViewItem.md): Represents a constituent item of the hierarchy displayed inside a (Markdown/T_MindFusion_Diagramming_TreeViewNode.md).
- [TreeViewNode Class](Markdown/T_MindFusion_Diagramming_TreeViewNode.md): Represents nodes that can draw hierarchical data.
- [TreeViewNodeStyle Class](Markdown/T_MindFusion_Diagramming_TreeViewNodeStyle.md): Represents a reusable set of properties that define the appearance of tree view nodes.
- [UndoEventArgs Class](Markdown/T_MindFusion_Diagramming_UndoEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#actionrecorded), (Markdown/T_MindFusion_Diagramming_DiagramBase.md#actionundone) and (Markdown/T_MindFusion_Di...
- [UndoManager Class](Markdown/T_MindFusion_Diagramming_UndoManager.md): Implements undo/redo functionality in MindFusion.Diagramming.
- [UndoValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_UndoValidationEventArgs.md): Contains the arguments passed to the (Markdown/T_MindFusion_Diagramming_DiagramBase.md#actionrecording) event handlers.
- [UnitType Enumeration](Markdown/T_MindFusion_Diagramming_AnchorUnitType.md): Defines values that indicate whether point positions are specified in percentage, or in absolute units relative to the node's top-left corner.
- [Vector Structure](Markdown/T_MindFusion_Diagramming_Vector.md): Represents a two-dimensional vector.
- [VideoNode Class](Markdown/T_MindFusion_Diagramming_VideoNode_0.md): Represents nodes that render video stream assigned to the VideoLocation property.
- [View3D Enumeration](Markdown/T_MindFusion_Diagramming_View3D.md): Defines keys used to associate 3D position data with a node through the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#layouttraits) property.
- [VisioContent Class](Markdown/T_MindFusion_Diagramming_VisioContent.md): Represents the content of a (Markdown/T_MindFusion_Diagramming_VisioNode.md).
- [VisioNode Class](Markdown/T_MindFusion_Diagramming_VisioNode.md): Represents a node that can display shapes from Visio stencils.
- [VisioNodeProperties Class](Markdown/T_MindFusion_Diagramming_VisioNodeProperties.md): Stores the values of (Markdown/T_MindFusion_Diagramming_VisioNode.md) properties during undo / redo operations. If you need to implement undo support for the additional properties defined by a clas...
- [VisioNodeStyle Class](Markdown/T_MindFusion_Diagramming_VisioNodeStyle.md): Represents a reusable set of properties that define the appearance of Visio nodes.
- [VisioStencil Class](Markdown/T_MindFusion_Diagramming_VisioStencil.md): Represents a Visio stencil.
- [VisitNode Delegate](Markdown/T_MindFusion_Diagramming_VisitNode.md): Defines the prototype for methods called by VisitNodes.
- [XmlOptions Class](Markdown/T_MindFusion_Diagramming_XmlOptions.md): Defines properties used to customize the XML serialization process.
- [XmlPersistContext Class](Markdown/T_MindFusion_Diagramming_XmlPersistContext.md): Contains methods that can help you serialize and deserialize MindFusion.Diagramming items to end from XML documents.
### Namespace MindFusion.Diagramming.Animations
- [BounceAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_BounceAnimation.md): Animates vertical position of nodes.
- [FillColorAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_FillColorAnimation.md): Animates the fill color of nodes or link arrowheads.
- [ItemAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_ItemAnimation.md): Base class of diagram item animations.
- [OpacityAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_OpacityAnimation.md): Animates items' opacity for fade-in and fade-out effects.
- [PathAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_PathAnimation.md): Animates node positions along specified path.
- [PulseAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_PulseAnimation.md): Animates node's local scale factor.
- [ShakeAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_ShakeAnimation.md): Animates horizontal position of nodes.
- [StrokeColorAnimation Class](Markdown/T_MindFusion_Diagramming_Animations_StrokeColorAnimation.md): Animates the color of node borders or link segments.
### Namespace MindFusion.Diagramming.Commands
- [AddGroupCmd Class](Markdown/T_MindFusion_Diagramming_Commands_AddGroupCmd.md): Implements creation of groups.
- [AddItemCmd Class](Markdown/T_MindFusion_Diagramming_Commands_AddItemCmd.md): Implements creation of new diagram items.
- [AddToContainerCmd Class](Markdown/T_MindFusion_Diagramming_Commands_AddToContainerCmd.md): Undoable command that implements an addition of a node to a container.
- [ChangeItemCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ChangeItemCmd.md): Handles undo / redo of programmatic property changes.
- [Command Class](Markdown/T_MindFusion_Diagramming_Commands_Command.md): Represent an action that can be carried out on a diagram, and later undone or redone.
- [CommandCollection Class](Markdown/T_MindFusion_Diagramming_Commands_CommandCollection.md): A collection of commands.
- [CommandContext Class](Markdown/T_MindFusion_Diagramming_Commands_CommandContext.md): The context of an executing command.
- [CommandList Class](Markdown/T_MindFusion_Diagramming_Commands_CommandList.md): Represents a read-only collection of (Markdown/T_MindFusion_Diagramming_Commands_Command.md) objects.
- [CompositeCmd Class](Markdown/T_MindFusion_Diagramming_Commands_CompositeCmd.md): Represents a set of (Markdown/T_MindFusion_Diagramming_Commands_Command.md) instances as a single operation. Undoing or redoing the composite action, respectively undoes or redoes all its constitue...
- [ContainerPagesCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ContainerPagesCmd.md): Tracks changes of the (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md#pages) collection of a (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md).
- [DisconnectLinkCmd Class](Markdown/T_MindFusion_Diagramming_Commands_DisconnectLinkCmd.md): Disconnects links from a deleted node.
- [EditTextCmd Class](Markdown/T_MindFusion_Diagramming_Commands_EditTextCmd.md): Represents undoable edit operations.
- [ExpandHeaderRowCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ExpandHeaderRowCmd.md): Implements undo and redo of collapsing or expanding the header row of a table section.
- [ExpandItemCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ExpandItemCmd.md): Implements expanding/collapsing trees of items.
- [ExpandTreeViewItemCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ExpandTreeViewItemCmd.md): Implements support for undo of (Markdown/T_MindFusion_Diagramming_TreeViewItem.md) collapse/expand operations.
- [FoldContainerCmd Class](Markdown/T_MindFusion_Diagramming_Commands_FoldContainerCmd.md): Undoable command that implements scrolling of table rows.
- [GroupAttachCmd Class](Markdown/T_MindFusion_Diagramming_Commands_GroupAttachCmd.md): Implements an addition of a subordinated item to a group.
- [GroupDetachCmd Class](Markdown/T_MindFusion_Diagramming_Commands_GroupDetachCmd.md): Implements removal of an item from a group.
- [ModifyItemCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ModifyItemCmd.md): Implements changes of item's size and position.
- [PageContainerCmd Class](Markdown/T_MindFusion_Diagramming_Commands_PageContainerCmd.md): Implements page navigation of (Markdown/T_MindFusion_Diagramming_PagedContainerNode.md).
- [RedimTableCmd Class](Markdown/T_MindFusion_Diagramming_Commands_RedimTableCmd.md): Implements changes to the number of table's rows and columns.
- [RemoveFromContainerCmd Class](Markdown/T_MindFusion_Diagramming_Commands_RemoveFromContainerCmd.md): Undoable command that implements an addition of a node to a container.
- [RemoveGroupCmd Class](Markdown/T_MindFusion_Diagramming_Commands_RemoveGroupCmd.md): Implements destruction of groups.
- [RemoveItemCmd Class](Markdown/T_MindFusion_Diagramming_Commands_RemoveItemCmd.md): Implements deletion of diagram items.
- [ResizeTableColumnCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ResizeTableColumnCmd.md): Implements resizing of table's columns.
- [ResizeTableRowCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ResizeTableRowCmd.md): Implements resizing of table's rows.
- [ScrollContainerCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ScrollContainerCmd.md): Implements support for undo of (Markdown/T_MindFusion_Diagramming_ContainerNode.md) scroll operations.
- [ScrollTableCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ScrollTableCmd.md): Implements scrolling of table's rows.
- [ScrollTreeViewCmd Class](Markdown/T_MindFusion_Diagramming_Commands_ScrollTreeViewCmd.md): Implements support for undo of (Markdown/T_MindFusion_Diagramming_TreeViewNode.md) scroll operations.
### Namespace MindFusion.Diagramming.Components
- [BorderComponent Class](Markdown/T_MindFusion_Diagramming_Components_BorderComponent.md): Represents a component which can draw a border around another component.
- [ButtonComponent Class](Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md): Represents a button-like component, which can respond to user clicks.
- [ButtonState Enumeration](Markdown/T_MindFusion_Diagramming_Components_ButtonState.md): Indicates the state of a button.
- [ButtonType Enumeration](Markdown/T_MindFusion_Diagramming_Components_ButtonType.md): Indicates the behavior of the button.
- [CheckBoxComponent Class](Markdown/T_MindFusion_Diagramming_Components_CheckBoxComponent.md): A check box component.
- [ComponentBase Class](Markdown/T_MindFusion_Diagramming_Components_ComponentBase.md): Represents the abstract base of all components.
- [ComponentEventArgs Class](Markdown/T_MindFusion_Diagramming_Components_ComponentEventArgs.md): The base class for arguments supplied to various component-related events.
- [ComponentMouseEventArgs Class](Markdown/T_MindFusion_Diagramming_Components_ComponentMouseEventArgs.md): Provides data to mouse-related component events.
- [ComponentValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_Components_ComponentValidationEventArgs.md): Contains the arguments passed to handlers of component validation events.
- [ContainerComponent Class](Markdown/T_MindFusion_Diagramming_Components_ContainerComponent.md): Represents a component which can host other components.
- [ContentComponent Class](Markdown/T_MindFusion_Diagramming_Components_ContentComponent.md): Represents a component which can host a single component as its child.
- [DrawButtonEventArgs Class](Markdown/T_MindFusion_Diagramming_Components_DrawButtonEventArgs.md): Contains the arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_Components_ButtonComponent.md#customdraw) event of button components.
- [DrawComponentEventArgs Class](Markdown/T_MindFusion_Diagramming_Components_DrawComponentEventArgs.md): The base class for arguments supplied to various component-related custom drawing events.
- [EditComponent Class](Markdown/T_MindFusion_Diagramming_Components_EditComponent.md): A text box-like component.
- [GridColumn Class](Markdown/T_MindFusion_Diagramming_Components_GridColumn.md): Represents a column in a grid.
- [GridPanel Class](Markdown/T_MindFusion_Diagramming_Components_GridPanel.md): Represents a container which arranges it's children in a two-dimensional grid.
- [GridRow Class](Markdown/T_MindFusion_Diagramming_Components_GridRow.md): Represents a row in a grid.
- [HorizontalAlignment Enumeration](Markdown/T_MindFusion_Diagramming_Components_HorizontalAlignment.md): Specifies the horizontal alignment of a component relative to its allocated space.
- [IAddChild Interface](Markdown/T_MindFusion_Diagramming_Components_IAddChild.md): Defines a method for adding child objects to a parent objects.
- [IComponentHost Interface](Markdown/T_MindFusion_Diagramming_Components_IComponentHost.md): Represents an object which can host components.
- [ImageComponent Class](Markdown/T_MindFusion_Diagramming_Components_ImageComponent.md): Represents a component which can display an image.
- [ITypeResolver Interface](Markdown/T_MindFusion_Diagramming_Components_ITypeResolver.md): Resolves types by their names.
- [JsonLoader Class](Markdown/T_MindFusion_Diagramming_Components_JsonLoader.md): Provides methods for loading component hierarchies from Json templates.
- [KeyboardEventArgs Class](Markdown/T_MindFusion_Diagramming_Components_KeyboardEventArgs.md): Provides data to keyboard-related events.
- [Length Class](Markdown/T_MindFusion_Diagramming_Components_Length.md): Represents size or distance.
- [LengthConverter Class](Markdown/T_MindFusion_Diagramming_Components_LengthConverter.md): The TypeConverter of the (Markdown/T_MindFusion_Diagramming_Components_Length.md) class.
- [LengthType Enumeration](Markdown/T_MindFusion_Diagramming_Components_LengthType.md): Specifies how a length will be interpreted.
- [NumericEditComponent Class](Markdown/T_MindFusion_Diagramming_Components_NumericEditComponent.md): Represents a numeric-only edit component.
- [Orientation Enumeration](Markdown/T_MindFusion_Diagramming_Components_Orientation.md): Specifies a general orientation.
- [ShapeComponent Class](Markdown/T_MindFusion_Diagramming_Components_ShapeComponent.md): Represents components which can display geometrical shapes.
- [SimplePanel Class](Markdown/T_MindFusion_Diagramming_Components_SimplePanel.md): A container which arranges its items so that they fill all available space.
- [SliderComponent Class](Markdown/T_MindFusion_Diagramming_Components_SliderComponent.md): Represents a slider component, which allows users to select a single value or a range of values.
- [SliderType Enumeration](Markdown/T_MindFusion_Diagramming_Components_SliderType.md): Specifies the type of a slider component.
- [SpinnerComponent Class](Markdown/T_MindFusion_Diagramming_Components_SpinnerComponent.md): Represents a spin edit component.
- [StackPanel Class](Markdown/T_MindFusion_Diagramming_Components_StackPanel.md): Represents a container which arranges its children either vertically or horizontally.
- [TextComponent Class](Markdown/T_MindFusion_Diagramming_Components_TextComponent.md): Represents a component displaying static unformatted text.
- [TextEventArgs Class](Markdown/T_MindFusion_Diagramming_Components_TextEventArgs.md): Provides arguments for text-related events.
- [TextValidationEventArgs Class](Markdown/T_MindFusion_Diagramming_Components_TextValidationEventArgs.md): Provides argument for text validation events.
- [TextWrapping Enumeration](Markdown/T_MindFusion_Diagramming_Components_TextWrapping.md): Specifies the type of text wrapping.
- [ValueChangedEventArgs(T) Class](Markdown/T_MindFusion_Diagramming_Components_ValueChangedEventArgs.md): Provides data for value change event handlers.
- [ValueChangingEventArgs(T) Class](Markdown/T_MindFusion_Diagramming_Components_ValueChangingEventArgs.md): Provides data for value validation event handlers.
- [VerticalAlignment Enumeration](Markdown/T_MindFusion_Diagramming_Components_VerticalAlignment.md): Specifies the vertical alignment of a component relative to its allocated space.
- [XmlLoader Class](Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md): Provides methods for loading component hierarchies from XML.
- [XmlLoaderException Class](Markdown/T_MindFusion_Diagramming_Components_XmlLoaderException.md): An exception raised when a (Markdown/T_MindFusion_Diagramming_Components_XmlLoader.md) fails to parse XML content.
### Namespace MindFusion.Diagramming.Export
- [AutoScale Enumeration](Markdown/T_MindFusion_Diagramming_Export_AutoScale.md): Specifies the auto-scale mode when exporting to a PDF document.
- [DxfExporter Class](Markdown/T_MindFusion_Diagramming_Export_DxfExporter.md): Exports diagrams to AutoDesk Drawing Exchange Format (DXF) files.
- [ExcelExporter Class](Markdown/T_MindFusion_Diagramming_Export_ExcelExporter.md): Exports MindFusion.Diagramming diagrams to Excel Open XML Format (XLSX) files.
- [ExportLanes Enumeration](Markdown/T_MindFusion_Diagramming_Export_ExportLanes.md): Defines values that indicate how the LaneGrid should be exported to Visio.
- [PdfExporter Class](Markdown/T_MindFusion_Diagramming_Export_PdfExporter.md): Exports diagrams to Adobe Portable Document Format (PDF) files.
- [SvgExporter Class](Markdown/T_MindFusion_Diagramming_Export_SvgExporter.md): Creates SVG (Scalable Vector Graphics) drawings from the content of (Markdown/T_MindFusion_Diagramming_Diagram.md) objects.
- [SwfExporter Class](Markdown/T_MindFusion_Diagramming_Export_SwfExporter.md): Creates Adobe Flash files representing the content of a diagram.
- [Visio2013Exporter Class](Markdown/T_MindFusion_Diagramming_Export_Visio2013Exporter.md): Exports the contents of (Markdown/T_MindFusion_Diagramming_Diagram.md) or (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) objects to Visio 2013 XML drawing files (.vsdx).
- [VisioExporter Class](Markdown/T_MindFusion_Diagramming_Export_VisioExporter.md): Exports diagrams to Visio 2003 XML Drawing files (.vdx).
- [WmfExporter Class](Markdown/T_MindFusion_Diagramming_Export_WmfExporter.md): Creates WMF (Windows MetaFile) images from the content of (Markdown/T_MindFusion_Diagramming_Diagram.md) objects.
### Namespace MindFusion.Diagramming.Import
- [ConnectorImportedEventArgs Class](Markdown/T_MindFusion_Diagramming_Import_ConnectorImportedEventArgs.md): Contains the arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_Import_VisioImporter.md#connectorimported) event.
- [DrawImporter Class](Markdown/T_MindFusion_Diagramming_Import_DrawImporter.md): DrawImporter lets you import an OpenOffice Draw document into a (Markdown/T_MindFusion_Diagramming_Diagram.md) or (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) object.
- [GroupImportedEventArgs Class](Markdown/T_MindFusion_Diagramming_Import_GroupImportedArgs.md): Contains the arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_Import_VisioImporter.md#groupimported) event.
- [ImportItemEventArgs Class](Markdown/T_MindFusion_Diagramming_Import_ImportItemEventArgs.md): Contains the arguments passed to handlers of the ImportItem event.
- [ShapeImportedEventArgs Class](Markdown/T_MindFusion_Diagramming_Import_ShapeImportedEventArgs.md): Contains the arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_Import_VisioImporter.md#shapeimported) event.
- [SvgImporter Class](Markdown/T_MindFusion_Diagramming_Import_SvgImporter.md): (Markdown/T_MindFusion_Diagramming_Import_SvgImporter.md) lets you import the contents of an SVG file into a (Markdown/T_MindFusion_Diagramming_Diagram.md) object.
- [Visio2013Importer Class](Markdown/T_MindFusion_Diagramming_Import_Visio2013Importer.md): Imports Visio 2013 XML Drawing files (.vsdx) into (Markdown/T_MindFusion_Diagramming_Diagram.md) or (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) objects.
- [VisioImporter Class](Markdown/T_MindFusion_Diagramming_Import_VisioImporter.md): Imports Visio 2003 XML Drawing files (.vdx) into MindFusion.Diagramming.
### Namespace MindFusion.Diagramming.Lanes
- [CellBoundsEventArgs Class](Markdown/T_MindFusion_Diagramming_Lanes_CellBoundsEventArgs.md): Contains the arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md#cellboundschanged) event.
- [Grid Class](Markdown/T_MindFusion_Diagramming_Lanes_Grid.md): Represents a lane grid.
- [Header Class](Markdown/T_MindFusion_Diagramming_Lanes_Header.md): Represents a header in a grid view.
- [HeaderCollection Class](Markdown/T_MindFusion_Diagramming_Lanes_HeaderCollection.md): Represents a strongly typed collection of (Markdown/T_MindFusion_Diagramming_Lanes_Header.md) objects.
- [HeaderEventArgs Class](Markdown/T_MindFusion_Diagramming_Lanes_HeaderEventArgs.md): Contains the arguments passed to handlers of header-related events.
- [HeaderResizeEventArgs Class](Markdown/T_MindFusion_Diagramming_Lanes_HeaderResizeEventArgs.md): Contains the arguments passed to handlers of header resize events.
- [ICell Interface](Markdown/T_MindFusion_Diagramming_Lanes_ICell.md): Defines a base for cells in a lane list.
- [ResizeType Enumeration](Markdown/T_MindFusion_Diagramming_Lanes_ResizeType.md): Specifies how to resize child columns and rows in the lanes grid when their parent column or row is resized.
- [Style Class](Markdown/T_MindFusion_Diagramming_Lanes_Style.md): Encapsulates the appearance properties of an element in a lane grid.
### Namespace MindFusion.Diagramming.Layout
- [AnnealLayout Class](Markdown/T_MindFusion_Diagramming_Layout_AnnealLayout.md): Implements a simulated annealing graph layout algorithm.
- [CascadeLayout Class](Markdown/T_MindFusion_Diagramming_Layout_CascadeLayout.md): Performs cascading layout on simple, connected graphs.
- [CircularLayout Class](Markdown/T_MindFusion_Diagramming_Layout_CircularLayout.md): Implements a circular graph layout algorithm. Nodes are distributed evenly on the circumference of a circle at positions that result in as few link crossing as possible.
- [CompositeLayout Class](Markdown/T_MindFusion_Diagramming_Layout_CompositeLayout.md): Implements a multi-level graph layout algorithm.
- [DecisionLayout Class](Markdown/T_MindFusion_Diagramming_Layout_DecisionLayout.md): Implements a flowchart layout algorithm.
- [Direction Enumeration](Markdown/T_MindFusion_Diagramming_Layout_Direction.md): Specifies a layout direction.
- [FlowchartLayout Class](Markdown/T_MindFusion_Diagramming_Layout_FlowchartLayout.md): FlowchartLayout can be used to arrange flowcharts representing program source code.
- [FlowLayout Class](Markdown/T_MindFusion_Diagramming_Layout_FlowLayout.md): Implements a flowchart, workflow and process diagrams layout algorithm.
- [FractalLayout Class](Markdown/T_MindFusion_Diagramming_Layout_FractalLayout.md): A tree layout algorithm that places child nodes symmetrically around their parent node.
- [GridLayout Class](Markdown/T_MindFusion_Diagramming_Layout_GridLayout.md): Implements a grid graph layout algorithm.
- [HierarchicalLayout Class](Markdown/T_MindFusion_Diagramming_Layout_HierarchicalLayout.md): Performs hierarchical layout on simple, connected, level-planar graphs.
- [ILayout Interface](Markdown/T_MindFusion_Diagramming_Layout_ILayout.md): Common interface for all MindFusion.Diagramming layout classes.
- [ISwimlaneGrid Interface](Markdown/T_MindFusion_Diagramming_Layout_ISwimlaneGrid.md): Represents an object which can be used by a (Markdown/T_MindFusion_Diagramming_Layout_SwimlaneLayout.md) to adjust the corresponding swimlane grid.
- [LaneGrid Class](Markdown/T_MindFusion_Diagramming_Layout_LaneGrid.md): Represents an (Markdown/T_MindFusion_Diagramming_Layout_ISwimlaneGrid.md) which operates on a (Markdown/T_MindFusion_Diagramming_Lanes_Grid.md) object.
- [LaneType Enumeration](Markdown/T_MindFusion_Diagramming_Layout_LaneType.md): Specifies where (Markdown/T_MindFusion_Diagramming_Layout_FlowLayout.md) gets the swimlane dimensions from.
- [LayeredLayout Class](Markdown/T_MindFusion_Diagramming_Layout_LayeredLayout.md): Implements a layered graph layout algorithm.
- [LayeredLayoutLinkType Enumeration](Markdown/T_MindFusion_Diagramming_Layout_LayeredLayoutLinkType.md): Specifies the style of the links after they are laid out.
- [LayeredLayoutStatistics Class](Markdown/T_MindFusion_Diagramming_Layout_LayeredLayoutStatistics.md): Encapsulates information about a layered layout which has already complete.
- [Layout Class](Markdown/T_MindFusion_Diagramming_Layout_Layout.md): The base class for all layout classes.
- [LayoutLink Delegate](Markdown/T_MindFusion_Diagramming_Layout_LayoutLink.md): Represents methods that are called by the layout algorithms when the position of a link changes.
- [LayoutNode Delegate](Markdown/T_MindFusion_Diagramming_Layout_LayoutNode.md): Represents methods that are called by the layout algorithms when the position of a node changes.
- [LayoutProgress Delegate](Markdown/T_MindFusion_Diagramming_Layout_LayoutProgress.md): Represents methods that are called to report on progress of layout algorithms.
- [LayoutSubgraph Delegate](Markdown/T_MindFusion_Diagramming_Layout_LayoutSubgraph.md): Represents methods that are called by the layout algorithms in order to perform custom arrangement of a subgraph.
- [MultipleGraphsPlacement Enumeration](Markdown/T_MindFusion_Diagramming_Layout_MultipleGraphsPlacement.md): Specifies graph orientation.
- [OneWayLayout Class](Markdown/T_MindFusion_Diagramming_Layout_OneWayLayout.md): Implements a one-way graph layout algorithm.
- [Orientation Enumeration](Markdown/T_MindFusion_Diagramming_Layout_Orientation.md): Specifies axial orientation.
- [OrthogonalLayout Class](Markdown/CC_T_MindFusion_Diagramming_Layout_OrthogonalLayout_0.md): Implements an orthogonal graph layout algorithm. Each link is drawn as a chain of alternating horizontal and vertical segments. Nodes are placed in a way that facilitates few links bends and crossi...
- [OrthogonalRouter Class](Markdown/T_MindFusion_Diagramming_Layout_OrthogonalRouter.md): Implements an orthogonal link routing algorithm.
- [SpringLayout Class](Markdown/T_MindFusion_Diagramming_Layout_SpringLayout.md): Implements the Spring-Embedder graph layout algorithm.
- [SpringLayoutLinkType Enumeration](Markdown/T_MindFusion_Diagramming_Layout_SpringLayoutLinkType.md): Specifies the style of the diagram links after they are laid out.
- [SwimlaneLayout Class](Markdown/T_MindFusion_Diagramming_Layout_SwimlaneLayout.md): Implements an algorithm which arranges nodes in lanes.
- [TopologicalLayout Class](Markdown/T_MindFusion_Diagramming_Layout_TopologicalLayout.md): Applies topological ordering to the graph. This layout makes it easy to discern graph features such as overall flow direction, cycles and nested cycles.
- [TreeLayout Class](Markdown/T_MindFusion_Diagramming_Layout_TreeLayout.md): Implements several algorithms for arranging tree structures.
- [TreeLayoutBalance Enumeration](Markdown/T_MindFusion_Diagramming_Layout_TreeLayoutBalance.md): Specifies how to order child nodes in order to produce tree layouts with custom balance.
- [TreeLayoutDirections Enumeration](Markdown/T_MindFusion_Diagramming_Layout_TreeLayoutDirection.md): Specifies the direction of a tree layout.
- [TreeLayoutLinkType Enumeration](Markdown/T_MindFusion_Diagramming_Layout_TreeLayoutLinkType.md): Specifies the style of the diagram links after they are laid out.
- [TreeLayoutType Enumeration](Markdown/T_MindFusion_Diagramming_Layout_TreeLayoutType.md): Specifies the type of a tree layout.
- [TreeMapLayout Class](Markdown/T_MindFusion_Diagramming_Layout_TreeMapLayout.md): Implements a tree map layout algorithm.
- [TriangularLayout Class](Markdown/T_MindFusion_Diagramming_Layout_TriangularLayout.md): Performs triangular layout on simple, connected graphs.
### Namespace MindFusion.Diagramming.Manipulators
- [Button Class](Markdown/T_MindFusion_Diagramming_Manipulators_Button.md): A button-like manipulator.
- [ButtonState Enumeration](Markdown/T_MindFusion_Diagramming_Manipulators_ButtonState.md): Indicates the state of a button.
- [CheckBox Class](Markdown/T_MindFusion_Diagramming_Manipulators_CheckBox.md): A check box-like manipulator.
- [DrawButtonEventArgs Class](Markdown/T_MindFusion_Diagramming_Manipulators_DrawButtonEventArgs.md): Contains the arguments passed to handlers of the (Markdown/T_MindFusion_Diagramming_Manipulators_Button.md#customdraw) event of button manipulators.
- [DrawManipulatorEventArgs Class](Markdown/T_MindFusion_Diagramming_Manipulators_DrawManipulatorEventArgs.md): The base class for arguments supplied to various manipulator-related custom drawing events.
- [Manipulator Class](Markdown/T_MindFusion_Diagramming_Manipulator.md): Base class for manipulators, which are user interface elements attached to a diagram item. The user can perform various manipulations on objects through their attached manipulators.
### Namespace MindFusion.Diagramming.WinForms
- [Alignment Enumeration](Markdown/T_MindFusion_Diagramming_WinForms_Alignment.md): Specifies the alignment of an object relative to its container.
- [ControlNode Class](Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md): (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) instances represent diagram nodes which can host .NET controls.
- [ControlNodeEventArgs Class](Markdown/T_MindFusion_Diagramming_WinForms_ControlNodeEventArgs.md): Contains the arguments passes to handlers of the control host serialization events, such as (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#serializecontrol).
- [ControlNodeProperties Class](Markdown/T_MindFusion_Diagramming_WinForms_ControlNodeProperties.md): Stores the values of (Markdown/T_MindFusion_Diagramming_WinForms_ControlNode.md) properties during undo / redo operations. If you need to implement undo support for the additional properties define...
- [ControlNodeStyle Class](Markdown/T_MindFusion_Diagramming_ControlNodeStyle.md): Represents a reusable set of properties that define the appearance of control nodes.
- [CopyHostedControlEventArgs Class](Markdown/T_MindFusion_Diagramming_WinForms_CopyHostedControlEventArgs.md): Contains the arguments passes to the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md#copyhostedcontrol) event handlers.
- [CustomCursors Class](Markdown/T_MindFusion_Diagramming_WinForms_CustomCursors.md): Provides a collection of cursor object to use with the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) control.
- [DiagramDocumentPrinter Class](Markdown/T_MindFusion_Diagramming_WinForms_DiagramDocumentPrinter.md): A component that prints (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) objects.
- [DiagramPrinter Class](Markdown/T_MindFusion_Diagramming_WinForms_DiagramPrinter.md): A component that prints (Markdown/T_MindFusion_Diagramming_Diagram.md) objects.
- [DiagramPrinterBase Class](Markdown/T_MindFusion_Diagramming_WinForms_DiagramPrinterBase.md): A component that prints diagrams.
- [DiagramView Class](Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md): A .NET Windows Forms control that displays the content of a (Markdown/T_MindFusion_Diagramming_Diagram.md) object.
- [DiagramView3D Class](Markdown/T_MindFusion_Diagramming_WinForms_DiagramView3D.md): Displays graphs in 3D.
- [DrawEventArgs Class](Markdown/T_MindFusion_Diagramming_WinForms_DrawEventArgs.md): Contains the arguments passed to general drawing event handlers.
- [InPlaceEditEventArgs Class](Markdown/T_MindFusion_Diagramming_WinForms_InPlaceEditEventArgs.md): Contains the arguments passed in-place editing related event handlers.
- [InputState Class](Markdown/T_MindFusion_Diagramming_WinForms_InputState.md): Encapsulates touch information, provided to the behavior classes.
- [Interaction Class](Markdown/T_MindFusion_Diagramming_WinForms_Interaction.md): Tracks mouse messages to implement user interaction with the diagram.
- [IPrintPreview Interface](Markdown/T_MindFusion_Diagramming_WinForms_IPrintPreview.md): An interface that should be implemented by custom Print Preview forms.
- [IScrollBarProvider Interface](Markdown/T_MindFusion_Diagramming_WinForms_IScrollBarProvider.md): Defines methods used by (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) to create scrollbar controls and bind them to the view's scroll position and zoom level.
- [ItemListView Class](Markdown/T_MindFusion_Diagramming_WinForms_ItemListView.md): A list view control that hosts (Markdown/T_MindFusion_Diagramming_DiagramItem.md)s and supports drag-and-drop to (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md).
- [LayerListView Class](Markdown/T_MindFusion_Diagramming_WinForms_LayerListView.md): Represents a list box with (Markdown/T_MindFusion_Diagramming_Layer.md) objects.
- [LayerListViewItem Class](Markdown/T_MindFusion_Diagramming_WinForms_LayerListViewItem.md): Represents an item within a (Markdown/T_MindFusion_Diagramming_WinForms_LayerListView.md) control.
- [Matrix3D Class](Markdown/T_MindFusion_Diagramming_WinForms_Matrix3D.md): Represents a 3x3 matrix used for transformations in 3-D space.
- [ModifierKeyActions Class](Markdown/T_MindFusion_Diagramming_WinForms_ModifierKeyActions.md): Maps keyboard modifier keys to special actions in MindFusion.Diagramming such as panning and drawing selection rectangle.
- [MoveNodesBehavior Class](Markdown/T_MindFusion_Diagramming_WinForms_MoveNodesBehavior.md): This class is used when the diagram behavior is set to (Markdown/T_MindFusion_Diagramming_Behavior.md).
- [NodeListView Class](Markdown/T_MindFusion_Diagramming_WinForms_NodeListView.md): Represents a list box with (Markdown/T_MindFusion_Diagramming_DiagramNode.md) objects.
- [Overview Class](Markdown/T_MindFusion_Diagramming_WinForms_Overview.md): The (Markdown/T_MindFusion_Diagramming_WinForms_Overview.md) control provides a scaled-down view of a (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) contents and allows scrolling and z...
- [PagedDiagramView Class](Markdown/T_MindFusion_Diagramming_WinForms_PagedDiagramView.md): Represents a view that displays the pages of a (Markdown/T_MindFusion_Diagramming_DiagramDocument.md).
- [PageRenamedEventArgs Class](Markdown/T_MindFusion_Diagramming_WinForms_PageRenamedEventArgs.md): Contains arguments for the ScrollArrowClicked event.
- [PaintControlEventArgs Class](Markdown/T_MindFusion_Diagramming_WinForms_PaintControlEventArgs.md): Contains the arguments passed to the PaintControlHost event handlers.
- [Palette Class](Markdown/T_MindFusion_Diagramming_WinForms_Palette.md): Represents a tool palette control that displays (Markdown/T_MindFusion_Diagramming_DiagramItem.md) objects grouped into categories. Items from the palette can be added to a diagram by drag-and-drop.
- [PaletteCategory Class](Markdown/T_MindFusion_Diagramming_WinForms_PaletteCategory.md): Represents a category in a (Markdown/T_MindFusion_Diagramming_WinForms_Palette.md) control.
- [PointerInfo Class](Markdown/T_MindFusion_Diagramming_WinForms_PointerInfo.md): Provides information to touch controllers about the user action.
- [PreviewOptions Class](Markdown/T_MindFusion_Diagramming_WinForms_PreviewOptions.md): Provides properties that allow customization of various aspects of the extended print-preview window.
- [PrintOptions Class](Markdown/T_MindFusion_Diagramming_WinForms_PrintOptions.md): Allows customization of various aspects of printing and print-preview.
- [Ruler Class](Markdown/T_MindFusion_Diagramming_WinForms_Ruler.md): The (Markdown/T_MindFusion_Diagramming_WinForms_Ruler.md) control provides horizontal and vertical scales that help users measure diagram items.
- [ScrollAnimation Class](Markdown/T_MindFusion_Diagramming_WinForms_ScrollAnimation.md): Animates the scroll position of a diagram view.
- [ShapeListBox Class](Markdown/T_MindFusion_Diagramming_WinForms_ShapeListBox.md): The (Markdown/T_MindFusion_Diagramming_WinForms_ShapeListBox.md) control displays a set of shapes defined via the (Markdown/T_MindFusion_Diagramming_Shape.md) class.
- [ShapeToolBar Class](Markdown/T_MindFusion_Diagramming_WinForms_ShapeToolBar.md): The (Markdown/T_MindFusion_Diagramming_WinForms_ShapeToolBar.md) control displays image buttons representing selected shapes defined via the (Markdown/T_MindFusion_Diagramming_Shape.md) class. Thes...
- [TabAlignment Enumeration](Markdown/T_MindFusion_Diagramming_WinForms_TabAlignment.md): Specifies the alignment of the tabs in a (Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md).
- [TabbedDiagramView Class](Markdown/T_MindFusion_Diagramming_WinForms_TabbedDiagramView.md): Represents a (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) that can display (Markdown/T_MindFusion_Diagramming_DiagramDocument.md) objects. The individual diagram pages can be activat...
- [Vector3D Class](Markdown/T_MindFusion_Diagramming_WinForms_Vector3D.md): Represents a displacement in 3-D space.
- [ViewAnimation Class](Markdown/T_MindFusion_Diagramming_WinForms_ViewAnimation.md): Base class of diagram view animations.
- [ZoomAnimation Class](Markdown/T_MindFusion_Diagramming_WinForms_ZoomAnimation.md): Animates the zoom level of a diagram view.
### Namespace MindFusion.Diagramming.WinForms.Behaviors
- [BehaviorBase Class](Markdown/T_MindFusion_Diagramming_WinForms_Behaviors_BehaviorBase.md): An abstract base class for classes that define how MindFusion.Diagramming reacts to users' actions with a mouse or other pointing devices.
- [CustomTypesBehavior Class](Markdown/T_MindFusion_Diagramming_WinForms_Behaviors_CustomTypesBehavior.md): This class is used when the diagram behavior is set to (Markdown/T_MindFusion_Diagramming_Behavior.md).
- [DrawLinksBehavior Class](Markdown/T_MindFusion_Diagramming_WinForms_Behaviors_DrawLinksBehavior.md): This class is used when the diagram behavior is set to (Markdown/T_MindFusion_Diagramming_Behavior.md).
- [DrawNodesBehavior(T) Class](Markdown/T_MindFusion_Diagramming_WinForms_Behaviors_DrawNodesBehavior_0.md): Implements functionality that allows users to draw nodes on the diagram canvas.
- [LinkNodesBehavior(T) Class](Markdown/T_MindFusion_Diagramming_WinForms_Behaviors_LinkNodesBehavior_0.md): Implements functionality that allows users to draw nodes on the diagram canvas, when the interaction starts from an unoccupied point, and to connect nodes with links when the interaction starts fro...
- [ModifyBehavior Class](Markdown/T_MindFusion_Diagramming_WinForms_Behaviors_ModifyBehavior.md): This class is used when the diagram behavior is set to (Markdown/T_MindFusion_Diagramming_Behavior.md).
- [PanBehavior Class](Markdown/T_MindFusion_Diagramming_WinForms_PanBehavior.md): Implements the Pan and PanAndModify behaviors.
- [SelectOnlyBehavior Class](Markdown/T_MindFusion_Diagramming_WinForms_Behaviors_SelectOnlyBehavior.md): This class is used when the diagram behavior is set to (Markdown/T_MindFusion_Diagramming_Behavior.md).
- [ZoomBehavior Class](Markdown/T_MindFusion_Diagramming_WinForms_Behaviors_ZoomBehavior.md): Implements the (Markdown/T_MindFusion_Diagramming_Behavior.md) behavior.
### Namespace MindFusion.Diagramming.WinForms.Controllers
- [ModifyLabelController Class](Markdown/T_MindFusion_Diagramming_WinForms_Controllers_ModifyLabelController.md): A controller that moves item labels.
- [NodeConstructor Delegate](Markdown/T_MindFusion_Diagramming_WinForms_Controllers_NodeConstructor.md): Creates new nodes.
- [PointerController Class](Markdown/T_MindFusion_Diagramming_WinForms_Controllers_PointerController.md): Processes mouse or touch events targeting a diagram element.
- [SinglePointerController Class](Markdown/T_MindFusion_Diagramming_WinForms_Controllers_SinglePointerController.md): Represents controllers that handle mouse or single-touch input.
### Namespace MindFusion.Diagramming.WinForms.Design
- [DiagramViewDesigner Class](Markdown/T_MindFusion_Diagramming_WinForms_Design_DiagramViewDesigner.md): Implements design-time support for the (Markdown/T_MindFusion_Diagramming_WinForms_DiagramView.md) control.
- [RulerDesigner Class](Markdown/T_MindFusion_Diagramming_WinForms_Design_RulerDesigner.md): Implements design-time support for the Ruler control.
### Namespace MindFusion.Drawing
- [Brush Class](Markdown/T_MindFusion_Drawing_Brush.md): (Markdown/T_MindFusion_Drawing_Brush.md) objects are used to fill the interiors of geometric shapes. (Markdown/T_MindFusion_Drawing_Brush.md) is abstract base class inherited by (Markdown/T_MindFus...
- [BrushCollection Class](Markdown/T_MindFusion_Drawing_BrushCollection.md): A collection of (Markdown/T_MindFusion_Drawing_Brush.md) objects.
- [GdiGraphics Class](Markdown/T_MindFusion_Drawing_GdiGraphics.md): A wrapper of the System.Drawing.Graphics class that implements the (Markdown/T_MindFusion_Drawing_IGraphics.md) interface.
- [GraphicObject Class](Markdown/T_MindFusion_Drawing_GraphicObject.md): The base class for graphical objects such as pens and brushes.
- [HatchBrush Class](Markdown/T_MindFusion_Drawing_HatchBrush.md): (Markdown/T_MindFusion_Drawing_HatchBrush.md) objects represent rectangular brushes with a hatch style, a foreground color, and a background color that are used to fill the interiors of geometric s...
- [IGraphics Interface](Markdown/T_MindFusion_Drawing_IGraphics.md): This interface exposes the public interface of the .NET System.Drawing.Graphics class.
- [ImageAlign Enumeration](Markdown/T_MindFusion_Drawing_ImageAlign.md): Specifies the position and alignment of a picture relative to its destination rectangle.
- [LinearGradientBrush Class](Markdown/T_MindFusion_Drawing_LinearGradientBrush.md): (Markdown/T_MindFusion_Drawing_LinearGradientBrush.md) objects represent brushes that fill the interiors of geometric shapes with a linear gradient.
- [PathGradientBrush Class](Markdown/T_MindFusion_Drawing_PathGradientBrush.md): (Markdown/T_MindFusion_Drawing_PathGradientBrush.md) represents a brush that fills the interiors of geometric shapes with a gradient.
- [Pen Class](Markdown/T_MindFusion_Drawing_Pen.md): (Markdown/T_MindFusion_Drawing_Pen.md) instances are used to draw the outline of geometric shapes.
- [PenCollection Class](Markdown/T_MindFusion_Drawing_PenCollection.md): A collection of (Markdown/T_MindFusion_Drawing_Pen.md) objects.
- [SolidBrush Class](Markdown/T_MindFusion_Drawing_SolidBrush.md): (Markdown/T_MindFusion_Drawing_SolidBrush.md) objects represent brushes of a single color that are used to fill the interiors of geometric shapes.
- [TextureBrush Class](Markdown/T_MindFusion_Drawing_TextureBrush.md): (Markdown/T_MindFusion_Drawing_TextureBrush.md) objects represent brushes that use images to fill the interiors of geometric shapes.
### Namespace MindFusion.Drawing.Design
- [StringFormatEditor Class](Markdown/T_MindFusion_Drawing_Design_StringFormatEditor.md): Design-time editor for System.Drawing.StringFormat objects.
### Namespace MindFusion.Layout
- [AnnealLayoutStatistics Class](Markdown/T_MindFusion_Layout_AnnealLayoutStatistics.md): Contains the accumulated costs for a graph configuration produced by AnnealLayout.
- [AssistantType Enumeration](Markdown/T_MindFusion_Layout_AssistantType.md): Indicates the type of an assistant node in a tree.
- [BaseLayout Enumeration](Markdown/T_MindFusion_Layout_BaseLayout.md): Specifies how OrthogonalRouter should arrange nodes.
- [ConnectorRules Class](Markdown/T_MindFusion_Layout_ConnectorRules.md): Represents a set of rules that are applied according to the logic identifiers of links.
- [FlowLayoutKeys Class](Markdown/T_MindFusion_Layout_FlowLayoutKeys.md): Defines keys that can be used to define FlowLayout rules.
- [FlowLayoutRules Class](Markdown/T_MindFusion_Layout_FlowLayoutRules.md): A class representing a set of rules that define the behavior of the (Markdown/T_MindFusion_Diagramming_Layout_FlowLayout.md) class.
- [FlowLayoutTraits Enumeration](Markdown/T_MindFusion_Layout_FlowLayoutTraits.md): Values used as keys in FlowLayout rules.
- [HierarchicalLayoutTraits Enumeration](Markdown/CC_T_MindFusion_Layout_HierarchicalLayoutTraits_1.md): Indicates item traits specific to hierarchical layouts. Members of this enumeration can be used as keys in the DiagramItem.LayoutTraits hashtable.
- [LayeredLayoutTraits Enumeration](Markdown/T_MindFusion_Layout_LayeredLayoutTraits.md): Indicates item traits specific to layered layouts. Members of this enumeration can be used as keys in the DiagramItem.LayoutTraits hashtable.
- [LayoutRules Class](Markdown/T_MindFusion_Layout_LayoutRules.md): Summary description for (Markdown/T_MindFusion_Layout_LayoutRules.md).
- [NodeRules Class](Markdown/T_MindFusion_Layout_NodeRules.md): Represents a set of rules that are applied according to the logic identifiers of node pairs.
- [OrderDirection Enumeration](Markdown/T_MindFusion_Layout_OrderDirection.md): Values controlling the direction of link segments in FlowLayout rules.
- [Pair Class](Markdown/T_MindFusion_Layout_Pair.md): Represents a coupling between two arbitrary objects.
- [PartitionMethod Enumeration](Markdown/T_MindFusion_Layout_PartitionMethod.md): Identifies graph partitioning methods supported by (Markdown/T_MindFusion_Diagramming_Layout_CompositeLayout.md).
- [Point3D Structure](Markdown/T_MindFusion_Layout_Point3D.md): Represents the coordinates of a point in a 3-dimensional space.
- [PreferredRules Enumeration](Markdown/T_MindFusion_Layout_PreferredRules.md): Specifies which set of rules to use.
- [RouteHeuristics Delegate](Markdown/T_MindFusion_Layout_RouteHeuristics.md): The link routing algorithm uses a heuristic function of this type in its prediction steps.
- [RoutingOptions Interface](Markdown/T_MindFusion_Layout_RoutingOptions.md): Allows customization of various aspects of the link routing algorithm.
- [SimpleKeys Class](Markdown/T_MindFusion_Layout_SimpleKeys.md): Defines keys that can be used to define FlowLayout rules.
- [SimpleLinkLogic Class](Markdown/T_MindFusion_Layout_SimpleLinkLogic.md): Contains link identifiers for the predefined SimpleRules set of rules.
- [SimpleNodeLogic Class](Markdown/T_MindFusion_Layout_SimpleNodeLogic.md): Contains node identifiers for the predefined SimpleRules set of rules.
- [SimpleOrientation Enumeration](Markdown/T_MindFusion_Layout_SimpleOrientation.md): Specifies the preferred orientation for the main connector type in FlowLayout.
- [SimpleRules Class](Markdown/T_MindFusion_Layout_SimpleRules.md): Class of simple rules applicable to the Flowlayout algorithm.
- [SpringLayoutMethod Enumeration](Markdown/T_MindFusion_Layout_SpringLayoutMethod.md): Specifies what energy model SpringLayout should use for the simulation.
- [SpringLayoutTraits Enumeration](Markdown/T_MindFusion_Layout_SpringLayoutTraits.md): Indicates item traits specific to (Markdown/T_MindFusion_Diagramming_Layout_SpringLayout.md). Members of this enumeration can be used as keys in the (Markdown/T_MindFusion_Diagramming_DiagramItem.m...
- [SwimlaneLayoutTraits Enumeration](Markdown/T_MindFusion_Layout_SwimlaneLayoutTraits.md): Indicates item traits specific to swimlane layouts. Members of this enumeration can be used as keys in the DiagramItem.LayoutTraits hashtable.
- [TreeLayoutTraits Enumeration](Markdown/T_MindFusion_Layout_TreeLayoutTraits.md): Indicates item traits specific to tree layouts. Members of this enumeration can be used as keys in the (Markdown/T_MindFusion_Diagramming_DiagramItem.md#layouttraits) hashtable.
- [TreeMapLayoutTraits Enumeration](Markdown/T_MindFusion_Layout_TreeMapLayoutTraits.md): Indicates item traits specific to tree map layouts. Members of this enumeration can be used as keys in the DiagramItem.LayoutTraits hashtable.
### Namespace MindFusion.Layout.Layout3D
- [Surface Enumeration](Markdown/T_MindFusion_Layout_Layout3D_Surface.md): Contains values specifying the type of surface on which nodes are initially placed when running 3D SpringLayout.
### Namespace MindFusion.Mapping
- [Column Class](Markdown/T_MindFusion_Mapping_Column.md): Represents a database column.
- [ColumnType Enumeration](Markdown/T_MindFusion_Mapping_ColumnType.md): Specifies a DBF column type.
- [Database Class](Markdown/T_MindFusion_Mapping_Database.md): Represents the DBF database associated with an ESRI map file.
- [Decoration Class](Markdown/T_MindFusion_Mapping_Decoration.md): Represents a decoration element drawn in a separate layer over the map.
- [DecorationLayerBase(TColor, TPalette) Class](Markdown/T_MindFusion_Mapping_DecorationLayerBase.md): Represents a layer containing decorative elements.
- [ICanvas Interface](Markdown/T_MindFusion_Mapping_ICanvas.md): Represents a drawing canvas.
- [ICanvasWithPalette(TColor) Interface](Markdown/T_MindFusion_Mapping_ICanvasWithPalette.md): Represents a drawing canvas with an associated palette of colors.
- [IPalette(TColor) Interface](Markdown/T_MindFusion_Mapping_IPalette.md): Represents a palette of colors.
- [ITransform Interface](Markdown/T_MindFusion_Mapping_ITransform.md): Represents a geometrical transform used to convert world coordinates to screen coordinates.
- [Label Class](Markdown/T_MindFusion_Mapping_Label.md): Represents a text label associated with map element.
- [Layer(TColor, TPalette) Class](Markdown/T_MindFusion_Mapping_Layer.md): Represents a map layer.
- [Map Class](Markdown/T_MindFusion_Mapping_Map.md): Represents a geographic map.
- [MapElement Class](Markdown/T_MindFusion_Mapping_MapElement.md): Represents visual elements of a map that can be drawn and hit-tested.
- [MapFeature Structure](Markdown/T_MindFusion_Mapping_MapFeature.md): Contains OpenStreetMap key and value tags describing a map feature.
- [MapLayerBase(TColor, TPalette) Class](Markdown/T_MindFusion_Mapping_MapLayerBase.md): Represents a map layer containing geometric shapes.
- [NullShape Class](Markdown/T_MindFusion_Mapping_NullShape.md): Represents a null shape with no geometric data; often used as a place holder until data becomes available.
- [Point Class](Markdown/T_MindFusion_Mapping_Point.md): Represents a point on the map with (Markdown/T_MindFusion_Mapping_Point.md#x) (longitude) and (Markdown/T_MindFusion_Mapping_Point.md#y) (latitude) coordinates.
- [Rect Class](Markdown/T_MindFusion_Mapping_Rect.md): A class representing a rectangular are on the map.
- [Row Class](Markdown/T_MindFusion_Mapping_Row.md): Represents a DBF database row.
- [RuntimePolicy Class](Markdown/T_MindFusion_Mapping_RuntimePolicy.md): Contains environment settings to use in implementation for current platform.
- [Shape Class](Markdown/T_MindFusion_Mapping_Shape.md): Represents geometrical shapes displayed on a map.
- [ShapeType Enumeration](Markdown/T_MindFusion_Mapping_ShapeType.md): Specifies the type of shapes contained in an ESRI map file.
- [StreetMapFeatures Class](Markdown/T_MindFusion_Mapping_StreetMapFeatures.md): A helper class used for OSM files import and rendering.
- [StreetShape Class](Markdown/T_MindFusion_Mapping_StreetShape.md): Represents a shape in OSM file format.
- [StreetShapeType Enumeration](Markdown/T_MindFusion_Mapping_StreetShapeType.md): Specifies the type of shapes contained in an OSM map file.
- [TextAlignment Enumeration](Markdown/T_MindFusion_Mapping_TextAlignment.md): Specifies text alignment.
- [Vector Class](Markdown/T_MindFusion_Mapping_Vector.md): Represents a two-dimensional vector.
### Namespace MindFusion.Scripting
- [ByteCode Class](Markdown/T_MindFusion_Scripting_ByteCode.md): Encapsulates the compiled result of a parsed tree and performs evaluations against that compiled result in various contexts.
- [CompileOptions Class](Markdown/T_MindFusion_Scripting_CompileOptions.md): Contains options for the (Markdown/T_MindFusion_Scripting_Compiler.md#compile) method.
- [Compiler Class](Markdown/T_MindFusion_Scripting_Compiler.md): Provides methods for compiling expressions to byte code.
- [EvaluateFunctionEventArgs Class](Markdown/T_MindFusion_Scripting_EvaluateFunctionEventArgs.md): Contains the arguments passed to (Markdown/T_MindFusion_Scripting_EvaluationContext.md#dispatchfunctioncall) event handlers.
- [EvaluationContext Class](Markdown/T_MindFusion_Scripting_EvaluationContext.md): Provides a context for evaluating a byte code.
- [ParseObjectEventArgs Class](Markdown/T_MindFusion_Scripting_ParseObjectEventArgs.md): Contains the arguments passed to (Markdown/T_MindFusion_Scripting_EvaluationContext.md#parseobject) event handlers.
### Namespace MindFusion.Tools.ShapeDesignerCtrl
- [GridStyle Enumeration](Markdown/T_MindFusion_Tools_ShapeDesignerCtrl_GridStyle.md): Specifies how to draw the grid - as lines or dots
- [OutlineChanged Delegate](Markdown/T_MindFusion_Tools_ShapeDesignerCtrl_OutlineChanged.md):
- [ShapeChanged Delegate](Markdown/T_MindFusion_Tools_ShapeDesignerCtrl_ShapeChanged.md): Defines the prototype for ShapeChanged event handlers.
- [ShapeDesigner Class](Markdown/T_MindFusion_Tools_ShapeDesignerCtrl_ShapeDesigner.md): Provides a design surface for creation or modification of Shape objects.
- [SourceCodeLanguage Enumeration](Markdown/T_MindFusion_Tools_ShapeDesignerCtrl_SourceCodeLanguage.md): Specifies the desired source code language - C# or Visual Basic