上一节我们初步介绍MindFusion.Diagramming框架
C#使用MindFusion.Diagramming框架绘制流程图(1):基础类型-CSDN博客
这里演示示例程序:
新建Windows窗体应用程序FlowDiagramDemo,将默认的Form1重命名为FormFlowDiagram.
右键FlowDiagramDemo管理NuGet程序包
输入MindFusion.Diagramming,选择安装,安装完成后会自动添加MindFusion.Diagramming相关引用.
设置.net framework4.6.2
在FormFlowDiagram窗体设计器中拖动一个控件 MindFusion.Diagramming.WinForms.DiagramView diagramView1,以及拖动一个组件MindFusion.Diagramming.Diagram diagram1
并设置diagramView1的属性Diagram为diagram1
窗体FormFlowDiagram设计器程序为
文件FormFlowDiagram.Designer.cs
namespace FlowDiagramDemo
{
partial class FormFlowDiagram
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.diagram1 = new MindFusion.Diagramming.Diagram();
this.diagramView1 = new MindFusion.Diagramming.WinForms.DiagramView();
this.btnGetFlow = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// diagram1
//
this.diagram1.TouchHitDistance = null;
this.diagram1.NodeCreated += new System.EventHandler<MindFusion.Diagramming.NodeEventArgs>(this.diagram1_NodeCreated);
//
// diagramView1
//
this.diagramView1.Diagram = this.diagram1;
this.diagramView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.diagramView1.LicenseKey = null;
this.diagramView1.Location = new System.Drawing.Po