■ AddFlow 클래스를 사용해 다이어그램을 생성한다. (핀 설정)
▶ MainForm.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using Lassalle.Flow; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : Form { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); CreateDiagram(this.addFlow); } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Private #region 다이어그램 생성하기 - CreateDiagram(addFlow) /// <summary> /// 다이어그램 생성하기 /// </summary> /// <param name="addFlow">AddFlow</param> private void CreateDiagram(AddFlow addFlow) { addFlow.PageUnit = GraphicsUnit.Point; addFlow.PinSize = 8; addFlow.NodeModel.FillColor = Color.LightYellow; addFlow.NodeModel.Pins = new List<PointF> { new Point(0 , 50 ), new Point(50 , 0 ), new Point(100, 50 ), new Point(50 , 100) }; addFlow.NodeModel.Font = new Font("Calibri", 14); addFlow.LinkModel.LineStyle = LineStyle.Orthogonal; addFlow.LinkModel.DrawColor = Color.Navy; // 2개 노드들을 생성한다. // 모든 노드를 위한 디폴트에 의해 정의된 것처럼 첫번째 2개 노드들은 4개의 핀들을 갖고 있다. // 그러나 세번째 노드는 3개의 핀들만 갖고 있다. Node node1 = new Node(100, 30 , 80, 80, "4 핀", addFlow); Node node2 = new Node(400, 250, 80, 80, "4 핀", addFlow); Node node3 = new Node(400, 30 , 80, 80, "3 핀", addFlow); node3.Pins = new List<PointF> { new Point(0, 50), new Point(100, 50), new Point(50, 100) }; addFlow.AddNode(node1); addFlow.AddNode(node2); addFlow.AddNode(node3); // 1개의 링크를 생성한다. this.AddLink(addFlow, node1, node2, 2, 0); } #endregion #region 링크 추가하기 - AddLink(addFlow, startNode, endNode, startPinIndex, endPinIndex) /// <summary> /// 링크 추가하기 /// </summary> /// <param name="addFlow">AddFlow</param> /// <param name="startNode">시작 노드</param> /// <param name="endNode">종료 노드</param> /// <param name="startPinIndex">시작 핀 인덱스</param> /// <param name="endPinIndex">종료 핀 인덱스</param> /// <returns>링크</returns> private Link AddLink(AddFlow addFlow, Node startNode, Node endNode, int startPinIndex, int endPinIndex) { Link link = new Link(startNode, endNode, startPinIndex, endPinIndex, "", addFlow); addFlow.AddLink(link); return link; } #endregion } } |