■ 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 |
using System.Drawing; using System.Drawing.Drawing2D; 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; // 커스텀 도형을 위해 사용될 그래픽스 패스를 생성한다. GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddArc(0, 0, 15, 15, 180, 90); graphicsPath.AddLine(10, 0 , 40, 10); graphicsPath.AddLine(40, 10, 50, 0 ); graphicsPath.AddLine(50, 0 , 80, 40); graphicsPath.AddLine(80, 40, 40, 30); graphicsPath.AddLine(40, 30, 0 , 40); graphicsPath.AddLine(0 , 40, 10, 20); graphicsPath.CloseFigure(); graphicsPath.AddEllipse(10, 10, 10, 10); graphicsPath.FillMode = FillMode.Alternate; addFlow.NodeModel.FillColor = Color.LightCoral; addFlow.NodeModel.GraphicsPath = graphicsPath; addFlow.NodeModel.ShadowStyle = ShadowStyle.RightBottom; addFlow.NodeModel.ShadowColor = Color.Silver; addFlow.NodeModel.ShapeFamily = ShapeFamily.Rectangle; Node node1 = new Node(80 , 50 , 100, 50, null, addFlow); Node node2 = new Node(260, 160, 70 , 70, null, addFlow); addFlow.AddNode(node1); addFlow.AddNode(node2); addFlow.AddLink(new Link(node2, node1, null, addFlow)); } #endregion } } |