The list below describes past changes and additions to MindFusion.Diagramming:
The EnableStyledText property of ItemLabel lets you enable or disable styled text rendering in node and link labels. Styled text can contain italic, bold, underline, subscript, superscript and color attributes applied to its substrings. The attributes are specified using HTML-like formatting tags embedded in the raw text, listed in Text Attributes and Formatting section of the help file.
The NodeLabel class allows multiple captions to be displayed for a single DiagramNode of any type. Node labels provide a set of properties allowing full customization of their display and positioning. Label position is defined by specifying a pin point and offset from it, set through SetCornerPosition, SetEdgePosition, SetCenterPosition methods. In addition, the HorizontalAlign and VerticalAlign properties of NodeLabel specify on which side of pin point to draw the label's caption.
For example, following code adds extra labels to top-left and bottom-right corners of a ShapeNode:
C# Copy Code |
---|
var node = diagram.Factory.CreateShapeNode(10, 50, 40, 30); |
The distribution now includes assemblies for .NET 6. Locally installed assemblies don't show automatically in toolbox at this time, you can either add them manually or through Nuget package manager.
For consistency with CellClicked and NodeClicked events, the control now also raises NodeDoubleClicked for a TableNode after CellDoubleClicked. To revert back to old behavior, set the PreventNodeEvent argument.
Set the EnableSpatialIndex property of Diagram to create an index of item positions for faster hit-testing and viewport clipping queries. This should greatly improve user interaction and rendering speed for diagrams containing tens of thousands or more items.
C# Copy Code |
---|
// it will take some time to populate the diagram with a million nodes, |
Note that rendering speed improves only when showing a smaller part of the diagram inside DiagramView's viewport. Rendering a lot of items at small zoom levels or in Overview's fit-all mode will still need a lot of processing, so you might want to apply constraints on minimal zoom level of diagram view and overview controls for large diagrams.
New PatternRouter class routes links by applying patterns of segment and turn sequences and accepting them when resulting paths do not cross nodes. A path is accepted if its final segment ends in target point and is orthogonal to respective side of target node. If there are several possible paths, the router selects the shortest one. The MinimumDistance property specifies minimum allowed distance of link segments from nodes. The PreferredDistance property specifies distance of first or last link bend from associated node. PatternRouter includes several predefined patterns designed to create consistent-looking paths, and allows creation of custom patterns. Custom patterns can be defined as sequence of RouteStep objects specifying whether the path advances by relative or absolute distance, or changes direction:
C# Copy Code |
---|
var rightZigzag = new RoutePattern(); |
The CompositeRouter class lets you chain link routers (objects implementing ILinkRouter interface) so that a link passes through the sequence until it gets routed successfully. Diagram's default LinkRouter is now set to a CompositeRouter instance containing a PatternRouter and GridRouter sequence. This applies the several standard pattern paths when possible, and otherwise routes links using the cost minimizing heuristics-based grid router.
Fix for cosmetic / zero-width pens no longer working after KB5006670 Windows Update. Before KB5006670 GDI+ used to apply them as 1-pixel wide lines regardless of graphics unit and zoom level, which the diagram control now implements internally.
Set the Scrollable property of ContainerNode to let users scroll the container's contents. The node then displays scrollbars at right and bottom edges that can be used to scroll interactively. The ScrollX and ScrollY properties let you determine current scroll position or change it programmatically. Note that in order to let container's content overflow and become scrollable, you must either disable AutoGrow, or allow users reduce container size by changing HandlesStyle and EnabledHandles properties from their default MoveOnly / Move values.
The control now supports several ways to zoom using lasso tool:
The MindFusion.Diagramming distribution now includes assemblies for .NET 5. Design time support is not available at this time, you can add DiagramView and other controls to a form only by code.
Type of ContextMenu property of Ruler control changed from ContextMenu to ContextMenuStrip.
CompositeNode templates can now be defined in JSON format compatible with MindFusion JavaScript diagramming library:
C# Copy Code |
---|
string template = @"{ |
Call the LoadJsonTemplate method to create components from JSON definition. The GenerateJsonTemplate method returns a JSON template generated from current component hierarchy.
Diagram items can now be animated through the Animation class from MindFusion.Animations namespace, letting you for example attract user attention to a node by running a bouncing animation:
C# Copy Code |
---|
// start bouncing animation |
By default, animations change the vertical position of nodes. Other node properties can be animated by providing an UpdateCallback function to the Animation constructor, which will be called each time an animation progresses. The Animation class implements several built-in animation and easing types, which allow implementing various effects such as bounce, slide in or out, fade in or out. Custom animation functions can be defined too.
ArrangeAnimated methods added to Diagram and ContainerNode classes animate the movement of items from their original locations to new locations assigned by the layout object. This can be used to create an explode effect by starting new layout from overlapping nodes on same position, or an insertion effect by adding a new node to an existing layout.
Diagrams can now be serialized in JSON format. This can be used for interoperability with MindFusion JavaScript diagramming library, or for general storage in JSON files or databases. To serialize a Diagram to a JSON string, call its SaveToJson method. To deserialize a diagram back from its JSON representation, call the LoadFromJson method. Custom item classes can implement JSON serialization for their additional properties by overriding the SaveToJson and LoadFromJson methods of DiagramItem. Such classes must be registered for serialization by calling the RegisterItemClass method and providing a string identifier for the clientClass parameter.
(beta version)
The MindFusion.Diagramming distribution now includes assemblies for .NET Core 3. Design time support is not available at this time, you can add DiagramView and other controls to a form only by code.
The ExcelExporter 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 Export overload that takes a DiagramDocument parameter creates a sheet for each DiagramPage in the document. The Export(Diagram) overload creates a single Excel sheet.
All graph layout classes now contain an async ArrangeAsync method that runs layout calculations in a background task. This is only available in .NET 4.5 build of the diagram assemblies.
C# Copy Code |
---|
async void OnLayoutLayered(object sender, EventArgs e) |
The shape of a ShapeNode can be flipped horizontally or vertically. Enable the AllowFlip property and the shape flips when an edge is dragged over its opposite edge. You can get or set current flip state using FlipX and FlipY properties.
Extension methods in MindFusion.Diagramming.Fluent and MindFusion.Diagramming.Layout.Fluent namespaces add support for fluent programming style:
C# Copy Code |
---|
using MindFusion.Diagramming.Fluent; |
A FreeFormNode 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 Behavior to DrawFreeForms or LinkFreeForms. Use the Points property of FreeFormNode to get or set outline points programmatically. If the 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 AutoCloseDistance, the node's Closed property is automatically set to true. AutoCloseDistance default value is float.MaxValue, so free-form nodes are always closed.
Additional drawing modes, convenient for touch input, convert FreeFormNode objects drawn by user to ShapeNode objects with most similar shape. To enable them, set Behavior to DrawFreeShapes or LinkFreeShapes. The shapes against which the user's input is matched are set via diagram's FreeFormTargets property. By default it contains Rectangle, Decision and Ellipse shapes.
LinkTextEditing and LinkTextEdited events are now raised also when the user edits a LinkLabel. The Label property of the respective event-arguments class identifies the LinkLabel that is being edited. Label is a null reference if the user is editing link's Text value. You can prevent users from editing Text and let them edit only labels by handling LinkTextEditing like this:
C# Copy Code |
---|
void OnLinkTextEditing(object sender, LinkValidationEventArgs e) { e.Cancel = e.Label == null; } |
MapNodes can render street maps in OpenStreetMap format. Call FromXml method of MapContent to load an .osm file. The pens and brushes used for drawing the map are stored within the StreetMapPens and StreetMapBrushes collections in the static StreetMapFeatures class. You can define additional pens and brushes for drawing and painting certain map features by using MapContent's AddPen and AddBrush methods.
Columns and rows of a TableNode can now be resized interactively if its AllowResizeColumns or AllowResizeRows properties are enabled. In order to resize, move the mouse pointer to the border line on column's right side or row's bottom side until it shows resize cursor and start dragging. The control raises TableColumnResizing and TableRowResizing events to let you validate new size or prevent resizing some elements. The TableColumnResized and TableRowResized events are raised after the operation completes.
The BarcodeNode 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 Format property, the encoded number or text is set via Content, and color of 1D bars / 2D modules via BarColor.
The diagram can now display shapes from stencil files in Visio 2003 XML stencil format (.vsx). To load a stencil file, use an instance of the VisioStencil class. The shapes are displayed in the diagram through VisioNode objects. To associate a stencil shape with the node, create an instance of the VisioContent class and assign it to the node's 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.
There is no separate trial build of the control assemblies anymore. Instead, set the LicenseKey property to disable the component's evaluation mode and stop displaying trial messages. If your application contains more than one DiagramView instance or other controls by MindFusion, you could call MindFusion.Licensing.LicenseManager.AddLicense(key) from application start-up code to specify the key once instead of setting it per each control. License key strings are now listed on the Keys & Downloads page at MindFusion's customer portal.
The MapNode class represents nodes that can render geographical maps. At this time map nodes can display the content of Esri shapefile files. The content of a map file is represented by an instance of the MapContent class that should be assigned to the Content property of a MapNode. When the map comes with associated DBF database file, map regions can display labels if the labelField argument of FromFile is specified and DrawLabels is enabled. The color of a map region can be set via an integer index assigned to a map's Shape object, which identifies the element of FillColors that should be used to paint the shape.
The SvgImporter class allows importing Scalable Vector Graphics files (*.svg) into MindFusion.Diagramming. Each top-level SVG group element is imported as a separate SvgNode, whose Content is set to the group's child elements. If the SVG file was exported from Visio or OpenOffice Draw, SvgImporter will create DiagramLink objects for groups it recognizes as connectors in order to recreate the original diagram model, though in this case it will not preserve fully the original appearance of connectors in SVG.
Tree maps represent hierarchies by nesting child nodes within their parents, where the areas of leaf nodes are proportional to their Weight values. Unlike other layout algorithms, TreeMapLayout expects hierarchies to be defined via grouping or containment (see AttachTo method and ContainerNode class), and will ignore any links in the diagram. The diagram area covered by the topmost nodes in a hierarchy is specified via the 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 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 Weight ratios differ greatly or nodes contain many children, some nodes could end up with very narrow rectangles.
DecisionLayout 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 HorizontalPadding and VerticalPadding property values. When links share the same row or column, they are placed at a distance specified via LinkPadding. The layout arranges nodes recursively starting from StartNode. If StartNode is not specified, the algorithm selects the root of the deepest branch of the graph's spanning tree as start node.
Layout algorithms now automatically resize diagram's Bounds if it's not large enough to fit the arranged content. To revert to old behavior and keep fixed Bounds size, set GrowToFit to false.
The Visio2013Exporter class can export the contents of Diagram and DiagramDocument objects to Visio 2013 VSDX files. In order to use it, add a reference to the MindFusion.Diagramming.Export.Visio.dll assembly. Similarly to the VDX format exporter, Visio2013Exporter relies on a template file, called Visio2013.vxt, containing some boilerplate Visio XML code. The template must be either located in same folder as the application assemblies, or its path must be specified via the TemplatePath property. At this time the exporter supports shapes from Visio basic and flowchart stencils.
PdfExporter can now add headers and footers to exported pages. To specify their contents and font, set the HeaderFormat, HeaderFont, FooterFormat and FooterFont properties. Adding a %P placeholder to HeaderFormat or FooterFormat will render the current page number at its position.
Now it is possible to resize multiple selected nodes simultaneously. To enable that, set the AllowMultipleResize property to true. When enabled, dragging a corner or side adjustment handle of any node resizes all nodes in the selection. The operation will be cancelled for all nodes if any of them does not accept its new size, e.g. if it's smaller than MinimumNodeSize value.
The Visio2013Importer class can import .vsdx files created by Visio 2013. In order to use it, you must add a reference to the MindFusion.Diagramming.Import.Visio.dll assembly. Various overloads of the Import method can be used to import the file into a DiagramDocument whose pages correspond to the Visio drawing pages, or into a single Diagram whose content is merged from all imported pages. At this time Visio2013Importer supports the basic flowchart and data flow Visio stencils. For each node shape from the .vsdx file, the importer creates a ShapeNode object whose Shape, Text, Brush and Pen properties are set to values corresponding to the imported Visio shape. For each connector shape, the importer creates a DiagramLink object whose Origin and Destination are set to the corresponding imported nodes, and whose ControlPoints reflect the geometry of the connector.
The ZoomControl class lets user change interactively the current zoom level and scroll position of a DiagramView. To set it up, add a ZoomControl to the form, place it anywhere over a DiagramView, and set the control's Target property to that view. Set the ZoomStep and ScrollStep properties to specify the amount added to view's zoom level or scroll position by ZoomControl's buttons. You can customize the control's appearance by setting properties such as Fill, BorderColor, CornerRadius and TickPosition.
FlowChart.NET can now be used under the Mono runtime for OSX or Linux. A single version of the mindfusion.* assemblies can be referenced by both Mono and Microsoft .NET applications. The control detects what runtime has loaded it, and provides alternative implementations for features that are currently missing from Mono.
The type of the MeasureUnit property has been changed from GraphicsUnit enum to MeasureUnit class. This class lets you define custom units by specifying their dots-per inch resolution, a string name, and number of standard divisions for display in the Ruler control. The MeasureUnit class is based on a previous implementation for use in Ruler from the MindFusion.Diagramming.WinForms namespace, and the ruler's Unit property has been updated to use the new class too.
There are two new predefined units available out of the box: Centimeter and WpfPoint. The latter also lets you load XML files created by WPF and Silverlight versions of the control into a Windows Forms application.
Shape formulas can now be parameterized by associating control points with Shape objects. Each control point is passed to the shape script as a named variable. Apart from the name, you can specify the default, min and max coordinates for each parameter via the ShapeControlPoint constructor, and whether to treat its values as percents or fixed offset.
The DrawImporter class can import .odg files, created by the OpenOffice Draw vector graphics editor. In order to use it, you must add a reference to the MindFusion.Diagramming.Import.Draw.dll assembly. Various overloads of the Import method can be used to import the OpenOffice drawing into a DiagramDocument whose pages correspond to the Draw pages, or into a single Diagram whose content is merged from all imported pages. DrawImporter supports shapes from the General and Flowchart shape palettes in Draw. For each node shape from the .odg file, the importer creates a ShapeNode object whose Shape, Text, Brush and Pen properties are set to values corresponding to the imported OpenOffice shape. For each connector shape, the importer creates a DiagramLink object whose Origin and Destination are set to the corresponding imported nodes, and whose ControlPoints reflect the geometry of the connector.
The Balance property of TreeLayout can be set to Preserve to keep the original geometric order of child nodes when arranging them under their parent. This can be used to arrange tree branches in a specific order by first positioning them in increasing horizontal or vertical positions. Another possibility is to apply TreeLayout from NodeModified handler to let users rearrange the tree branches by dragging and dropping a node.
MindFusion.Diagramming now includes support for Visual Studio 2012. The installer can create VS2012 toolbox palette for the component, and can optionally install VS2012 sample projects. In addition, toolbox palettes are now created for all .NET target frameworks supported by the respective Visual Studio versions.
The size of the magnifier tool can now be specified independently on both axes through the MagnifierWidth and MagnifierHeight properties. The MagnifierRadius property has been removed. The shape of the magnifier tool can now be customized through the MagnifierShape property.
The ruler units can now be specified more precisely through instances of the new MeasureUnit class. The MeasureUnit class provides several built-in units as well as the opportunity to create custom units of measure. As a result, the RulerUnit enumeration has been removed and the type of the Unit property has been changed. The InchDivisions property of the Ruler class has been removed as well - the division information is now built into the MeasureUnit type and no longer needs to be specified explicitly. Custom divisions can still be specified for any unit by creating a custom MeasureUnit instance and providing the appropriate value in the standardDivisons constructor parameter.
The appearance of the items in a diagram can now be modified using styles. The style represents a set of properties, which can be applied to an individual diagram item (by assigning it to the DiagramItem.Style property) or to all items of a specific type (by using a Theme). The styles can be easily expanded to include the properties in derived item classes.
The theme represents a collection of styles. Each style in the theme is associated with the diagram items of a specific type and affects all items of this type. Themes can be loaded from XML files. New themes can be created using the Theme Editor tool. Several pre-defined theme files are installed under the Themes subfolder of the control's root installation folder.
For more information about this new feature, check Styles and Themes.
The DiagramDocument class represents a collection of diagram pages or sheets, represented by DiagramPage objects. DiagramPage is derived from Diagram and only adds a Title property, so any current code that processes Diagram objects will work with DiagramPage objects too. New pages can be added to the document and existing pages can be removed and reordered via the Pages collection. The diagram document provides higher level of events for the pages contained inside it. The document supports the notion of an active page. The documents can also be exported to PDF and Visio, and imported from Visio using the new overloads available in the PdfExporter, VisioExporter and VisioImporter classes respectively.
The new TabbedDiagramView can be used to display DiagramDocument objects. The view displays tabs for the individual pages in the document. 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.
The OneWayLayout 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.
The LinkLabel class allows multiple captions to be displayed for a single DiagramLink object. Link labels provide a set of properties allowing full customization of their display and positioning. Labels can also be arranged automatically to avoid overlapping nodes and other labels by setting LinkLabel.AutoArrange to true.
The NodeListView is a ListBox control that can host any type of DiagramNode objects. Nodes from to the NodeListView control can be drag-and-dropped onto a Diagram, which creates a clone of the dragged node at the drop position.
Items can now be assigned to layers, and layers can be hidden, locked or moved up/down in the Z order as a group. Set the LayerIndex property of items to associate them with layers in the Diagram.Layers collection. The Layer objects provide Visible, Locked and ZIndex properties, which will affect all items in the respective layer. Layers also expose a Title property shown in the LayerListView control. Newly drawn items are added to the layer specified via Diagram.ActiveLayer.
For additional information about layers, refer to Layers.
The LayerListView control provides user interface for working with Layer objects. The control displays a list of all layers in a specified Diagram with a title and an overview area, and also allows editing of layer's Title, Visible and Locked properties and choosing the Diagram's currently active layer. New layers can be added to the Diagram by clicking the '+' button. The selected layer can be deleted by clicking the '-' button.
The .NET 4 version of MindFusion.Diagramming takes advantage of the Task Parallel Library (TPL) to enable parallelism on the different layout algorithms. Set the EnableParallelism property on the Layout class to true to enable arranging different subgraphs on different threads to possibly improve performance on multiprocessor systems. In addition, the maximum degree of concurrency can be manipulated through the MaxDegreeOfParallelism property. Note that only independent subgraphs are processed in parallel, so the SplitGraph property of layout classes that provide it must also be set.
The new magnifier tool allows users to interactively zoom in (or out) portions of the diagram by holding down a modifier key or pressing a mouse button. The magnifier's zoom factor and appearance can be customized. Additional information can be found in the corresponding section of Scrolling and Zooming.
For more detailed description of changes and additional information about how to move to version 6.0, check the Moving to MindFusion.Diagramming 6 topic.
Two new visual effects can be applied to nodes - Glass and Aero. In addition, the existing Emboss and Smooth Shadow effects are now applied to all node types, not just ShapeNode.
A new API is provided to facilitate effects usage. To apply an effect, create an instance of one of the effect classes, set up its properties, then add the instance to the Diagram.NodeEffects collection. Currently, there are four effect types available - EmbossEffect, SmoothShadowEffect, GlassEffect, and AeroEffect. Effects can be added, removed or modified at any time and this will immediately reflect on the diagram. Effects of different types can be applied simultaneously. It is also possible to apply more than one effect of the same type.
The old EnableEmbossEffects and EnableShadowEffects properties are reworked internally to use the new effect pipeline. Turning these properties on will automatically add an instance of the appropriate class to the NodeEffects collection. Therefore clearing the NodeEffects collection will turn these properties off if they were previously enabled. Keep in mind that the Diagram.EffectsProvider property is still required in order to enable the Emboss and Smooth Shadow effects.
The CompositeLayout exposes several new properties. The UseAdditionalPartitioning property can be set to true in order to enable additional partitioning pass after the default partition. This is especially useful when the initial partitioning produces a graph with nodes with many leaf children.
This variation of the fractal layout places child nodes around their parents, such, that the child nodes do not overlap. This layout also takes into consideration the size of the nodes and tries to arrange them to minimize occupied space. The layout can optionally prevent links from crossing nodes by bending them.
If 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 AutoAlignDistance property. The pair of aligned nodes is indicated visually by drawing an alignment guide using the pen assigned to AlignmentGuidePen.
FractalLayout 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 Root property. If it is not specified, the algorithm automatically selects a root that leads to more balanced distribution of nodes.
Now links can automatically connect to the nearest diagram node without the mouse pointer reaching the node. This is enabled by setting the AutoSnapLinks property. The maximum distance at which auto-snap works can be specified through AutoSnapDistance. The LinksSnapToBorders property, which implemented similar functionality when the mouse is directly over a node, has been removed.
CompositeNode components are now automatically serialized when saving in binary or XML format. It is also possible to serialize custom components by overriding the SaveTo, LoadFrom, SaveToXml, LoadFromXml methods of ComponentBase. Saving all components along with their attributes could lead to a lot of wasted space for node types derived from CompositeNode that have the same component hierarchy. In such scenarios, override the SerializeComponents method and return false to stop component serialization, and save only the relevant node properties by overriding the SaveTo, LoadFrom, SaveToXml, LoadFromXml methods of CompositeNode.
CompositeLayout partitions the diagram into several subgraphs and applies the algorithm specified via the SubgraphLayout property on each part. If the part is a tree, it is arranged using the algorithm specified via the SubtreeLayout property, which is set to a radial TreeLayout instance by default. Finally the algorithm specified via MasterLayout is applied on the graph that represents the overall partition. By running the polynomial-complexity layout algorithms on small subgraphs, CompositeLayout is able to process a large graph much faster than if a layout algorithm is applied on the whole graph.
CompositeLayout can run on custom partitions specified as lists of nodes, or automatically partition the diagram via two automatic methods based on graph connectivity and graph path lengths. Set the PartitionMethod and CustomPartition properties to specify how the diagram should be partitioned.
Shape instances can be defined using custom code that takes into consideration the current width and height of nodes. This allows creating shapes whose primitive elements change non-uniformly, e.g. by growing only in width or height when a node is resized. There are two ways to create such shapes. The first one is to use the Shape constructor that takes a CreatePathDelegate parameter, which can be implemented using a .NET function. Another Shape constructor takes a string argument that represents a Visio-like shape formula evaluated in run-time. The latter method enables serializing the shape code in external files, which can be reused by different applications and by MindFusion components for other platforms.
A new component subsystem is now available for use in MindFusion.Diagramming. The components represent graphical widgets similar to controls, which can be arranged in hierarchies and added to a Diagram through instances of the new CompositeNode class. The component system contains various built-in components, such as TextComponent and ButtonComponent. 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. A new tutorial section has been added describing various component features in a step-by-step examples. To check it out, visit Using Components.
SwfExporter creates Adobe Flash files representing the content of a diagram. In order to use this component, add references to the MindFusion.Diagramming.Export.Swf.dll and MindFusion.Swf.dll assemblies to your project. To export a diagram to SWF file, create an SwfExporter instance and call its Export method, passing a Diagram object as parameter. At the time of writing this, the diagram is exported as static image; interactivity is planned for next releases.
CascadeLayout 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 Orientation property.
TriangularLayout 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.
HierarchicalLayout 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 will not intersect. A graph is considered level-planar if it is possible to draw it without link intersections when its nodes are positioned on predefined levels. The layout method requires that for each node LayoutTraits contains a HierarchicalLayoutTraits.Level entry specifying the level, and no two connected nodes must be on the same level.
SwimlaneLayout 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 LayoutTraits[SwimlaneLayoutTraits.Lane].
By default, the algorithm works with the diagram's LaneGrid, but its SwimlaneGrid property can be set to any class that implements ISwimlaneGrid. This allows applying the layout to a custom-drawn grid rendered through the DrawBackground event, or one composed of locked background nodes.
WmfExporter creates WMF (Windows MetaFile) images from the content of Diagram objects. In order to use this component, add a reference to the MindFusion.Diagramming.Export.Wmf.dll assembly to your project. To create a WMF file from a diagram, create a WmfExporter instance and call its Export method, passing a Diagram object as parameter.
The package now includes a .NET 4 version of the MindFusion.Diagramming assembly, available in the VS2010 subfolder of the installation folder. That subfolder also includes sample projects for Visual Studio 2010. Versions 2 and 3 of the .NET runtime are still supported.
The type of the HeadShape, BaseShape and IntermediateShape properties of DiagramLink has been changed from enum ArrowHead to class Shape, which is also used to define ShapeNode shapes. The ArrowHeads class now exposes Shape definitions that correspond to the ArrowHead enumeration members from previous versions. It is also possible to assign any Shapes member or a custom shape as an arrowhead. When used for arrowheads, position (50, 0) in the shape definition corresponds to the arrowhead's tip point.
The ActiveItemHandlesColor, SelectedItemHandlesColor and DisabledHandlesColor properties have been replaced by ActiveItemHandlesStyle, SelectedItemHandlesStyle and DisabledHandlesStyle. The HandlesVisualStyle objects returned by them provide sub-properties for greater control over the appearance of selection handles. The adjustment handles can now be painted not only in solid color but with arbitrary brushes, such as LinearGradientBrush and TextureBrush objects.
If the underlying graph if acyclic, TopologicalLayout arranges the nodes linearly in such a way that each node comes before all destination nodes of its outgoing links. The links are drawn as curves above the chain of nodes, with their height proportional to the distance between the nodes. If the graph is not acyclic, the layout algorithm finds an ordering with a minimal number of back links, and draws the back links below the chain of nodes.
The Query method of DiagramItem can be used to find items that can be reached from the current one by following a path described in the query expression specified as argument. The expression includes selectors separated by a / character, where each selector returns the items from the result set of the previous step. The expressions can also include boolean predicates that filter the results using boolean and arithmetic expressions.
The PdfExporter component now should automatically recognize the language of the items labels and apply the correct encoding in the exported PDF documents. Apart from the standard Western character set, officially supported are Chinese, Japanese, Korean and Central-European character sets.
The SvgNode class represents nodes that can display SVG drawings in addition to the rendering provided by its base ShapeNode class. The SVG drawing is rendered after the associated Image and just before the DrawNode event is raised with CustomDraw.Additional. The SVG drawing of the node is specified through its 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.
The TreeViewNode class represents nodes that can display hierarchical data. The root items displayed in the node can be accessed through the 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 TreeViewItem class.
This version adds predefined Shape definitions that implement the Object Management Group / Business Process Management notation. They are available as members of the Shapes class and have names that start with a Bpmn prefix. They can also be accessed by ID using the FromId method of Shape.
Now DiagramView3D can be used to edit graphs in 3D space. Set the Behavior property to a value different than DoNothing to allow users select and modify existing items or draw new ones. New items are drawing 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 CreationPlaneDistance property.
FlowchartLayout recognizes program code -like patterns in the graph, such as loops, sequences and if/switch branching, and arranges them recursively. FlowchartLayout 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.
A much faster link routing algorithm has been implemented. It can arrange a thousand links for just a few seconds, while older versions would require several minutes. Now it is also possible to create custom routing classes to be used when a link must be routed by implementing the ILinkRouter interface. An instance of such class can be set through the LinkRouter property of the Diagram. MindFusion.Diagramming provides two classes that implement ILinkRouter - GridRouter and QuickRouter. By default LinkRouter is set to a QuickRouter instance.
The OrthogonalLayout 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.
CircularLayout distributes nodes evenly on the circumference of a circle at positions that result in as few link crossing as possible. Set its Radius property to specify the size of the layout circle. Use SiftingRounds to set the number of fine-tuning crossing-reduction iterations.
The following algorithms have been optimized greatly for speed:
The TreeLayout algorithm can produce a grid drawing of a full binary tree, aligning child nodes either horizontally or vertically to their parents in a way that the layout covers minimal area. To apply this layout, set the Type property to HorizontalVertical and call Arrange.
Now you can assign 3D positions to diagram nodes, and display their projections on screen using the DiagramView3D control. 3D positions are set through the LayoutTraits property of nodes by associating a Point3D value with the View3D.Position key. The size of nodes is inferred from their Bounds property. The CameraPosition and CameraRotation properties let you specify the position of the camera within the 3D scene. The nodes are always rendered as if facing the camera, i.e. you cannot view them edge on.
The MindFusion.Diagramming package now includes .NET 3.5 assemblies and sample VS2008 projects.
The CreateEditControl event lets you use any Windows Forms control to allow users edit the content of a diagram item. This event is raised when entering in-place editing mode, either by double-clicking an item or when the BeginEdit method is invoked. You could handle the event to return a composite control for editing many of the item's properties, and not only the text. When leaving in-place editing mode, the DiagramView raises DestroyEditControl to let you copy to the item any values entered by the user and close the custom editor.
It is no longer necessary to use GraphicsUnit.World to make the fonts scale when zooming the diagram view or displaying the diagram inside an Overview control. Now the fonts are scaled correctly regardless of their Unit.
Now the text of ContainerNode and DiagramLink objects can be edited in place too. In addition, the BeginEdit method of DiagramView and the InplaceEditable interface have been changed to allow choosing the edit box location according to the current mouse position. At this time, this is used in the DiagramLink in-place editing implementation, but you could use it for your own item types.
Note that if AllowInplaceEdit is enabled, the user will be able to edit the text of links and containers by double-clicking them. If that's not desired for these types of items, handle the LinkTextEditing and NodeTextEditing events to prevent the in-place edit operation.
SvgExporter and PdfExporter can create hyperlinks when the HyperLink property of items is set. The type of hyperlinks to create is defined via the HyperLinkStyle property, available for both export components. SvgExporter provides an additional HyperLinkTarget property, which defines the target window of the hyperlink.
Previous versions of the control supported wrapping text to a new line only at word boundaries. Now the default is to split words into multiple parts if there is not enough space to fit a whole word. If you prefer the old behavior, set the Trimming member of TextFormat to StringTrimming.Word.
Now you can disable the automatic text wrapping by enabling the NoWrap flag in the FormatFlags member of 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.
The FlowLayout algorithm can be used to lay out flowcharts 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.