■ 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
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.NodeModel.DrawColor = Color.Blue; addFlow.NodeModel.FillColor = Color.LightBlue; addFlow.NodeModel.GradientColor = Color.LightBlue; addFlow.NodeModel.ShapeFamily = ShapeFamily.Ellipse; addFlow.LinkModel.IsArrowDst = false; addFlow.LinkModel.DrawColor = Color.Blue; #region 노드 위에 캡션을 추가한다. Node titleNode = new Node(40 , 100, 80 , 80 , null, addFlow); addFlow.AddNode(titleNode); Caption titleCaption = new Caption(40, 60, 80, 20, "제목", titleNode, addFlow); addFlow.AddCaption(titleCaption); #endregion #region 노드 주변에 캡션을 도킹한다. Node dockingNode = new Node(460, 40 , 250, 200, null, addFlow); dockingNode.ShapeFamily = ShapeFamily.Rectangle; addFlow.AddNode(dockingNode); Caption topCaption = new Caption(50, 130, 90, 20, "1 : 위쪽", dockingNode, addFlow); topCaption.DrawColor = Color.Transparent; topCaption.FillColor = Color.LightGreen; topCaption.GradientColor = Color.LightGreen; topCaption.Dock = DockStyle.Top; topCaption.IsHitTestVisible = false; Caption leftCaption = new Caption(50, 160, 60, 20, "2 : 왼쪽", dockingNode, addFlow); leftCaption.DrawColor = Color.Transparent; leftCaption.FillColor = Color.Yellow; leftCaption.GradientColor = Color.Yellow; leftCaption.Dock = DockStyle.Left; leftCaption.IsHitTestVisible = false; Caption bottomCaption = new Caption(50, 190, 60, 20, "3 : 아래쪽", dockingNode, addFlow); bottomCaption.DrawColor = Color.Transparent; bottomCaption.FillColor = Color.LightSalmon; bottomCaption.GradientColor = Color.LightSalmon; bottomCaption.Dock = DockStyle.Bottom; bottomCaption.IsHitTestVisible = false; Caption rightCaption = new Caption(50, 220, 60, 20, "4 : 오른쪽", dockingNode, addFlow); rightCaption.DrawColor = Color.Transparent; rightCaption.FillColor = Color.LightGray; rightCaption.GradientColor = Color.LightGray; rightCaption.Dock = DockStyle.Right; rightCaption.IsHitTestVisible = false; Caption fillCaption = new Caption(50, 250, 90, 20, "5 : 채우기", dockingNode, addFlow); fillCaption.DrawColor = Color.Transparent; fillCaption.FillColor = Color.LightSlateGray; fillCaption.GradientColor = Color.LightSlateGray; fillCaption.Dock = DockStyle.Fill; fillCaption.IsHitTestVisible = false; addFlow.AddCaption(topCaption ); addFlow.AddCaption(leftCaption ); addFlow.AddCaption(bottomCaption); addFlow.AddCaption(rightCaption ); addFlow.AddCaption(fillCaption ); #endregion #region 링크에 캡션을 추가한다. Node startNode = new Node(60 , 400, 40 , 40 , null, addFlow); Node endNode = new Node(660, 400, 40 , 40 , null, addFlow); addFlow.AddNode(startNode); addFlow.AddNode(endNode ); Link link = new Link(startNode, endNode, null, addFlow); addFlow.AddLink(link); Caption startCaption = new Caption(100, 380, 140, 20, "시작 제목", link, addFlow); startCaption.AnchorPositionOnLink = 0f; addFlow.AddCaption(startCaption); Caption middleCaption = new Caption(310, 380, 140, 20, "중간 제목", link, addFlow); middleCaption.AnchorPositionOnLink = 0.5f; addFlow.AddCaption(middleCaption); Caption endCaption = new Caption(520, 380, 140, 20, "종료 제목", link, addFlow); endCaption.AnchorPositionOnLink = 1f; addFlow.AddCaption(endCaption); #endregion } #endregion } } |