남윤형

c# 스테이지 전체를 올렸음

도형간의 선을 그어주는 함수 추가
1 +<?xml version="1.0" encoding="utf-8" ?>
2 +<configuration>
3 + <startup>
4 + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5 + </startup>
6 +</configuration>
...\ No newline at end of file ...\ No newline at end of file
...@@ -9,60 +9,63 @@ using System.Windows.Forms; ...@@ -9,60 +9,63 @@ using System.Windows.Forms;
9 namespace flowchart 9 namespace flowchart
10 { 10 {
11 // flowchart를 그리는 판넬에 필요한 기능을 삽입. (Panel 객체를 상속해서 사용했음) 11 // flowchart를 그리는 판넬에 필요한 기능을 삽입. (Panel 객체를 상속해서 사용했음)
12 - // 마우스 클릭을 놓으면 어떤 도형을 선택했는지 판단해서, 해당 자료구조를 생성하고, 페인트 함수를 통해 그린다. 12 + // 마우스 클릭을 놓으면 어떤 도형 또는 선을 선택했는지 판단해서, 해당 자료구조를 생성하고, 페인트 함수를 통해 그린다.
13 class CustomPanel : Panel 13 class CustomPanel : Panel
14 { 14 {
15 - private String _figName; // NONE, RECTANGLE, RHOMBUS 15 + private String _state; // NONE, DRAW, MOVE
16 - private List<FigBase> _shapes = new List<FigBase>(); // 선택된 도형을 저장한 리스트 자료구조 16 + private String _figName; // NONE, RECTANGLE, RHOMBUS, LINKLINE, ETC
17 - private String _state; // NONE, DRAW, MOVE 17 +
18 - private Point _dragStartPoint = new Point(-1, -1); // 도형을 움직일때 시작위치 18 + private List<FigBase> _shapes = new List<FigBase>(); // 도형을 저장한 리스트 자료구조
19 - private FigBase _findShape = null; // 자료구조에서 찾은 도형을 임시 저장하는 변수 19 + private List<FigLinkline> _linkLines = new List<FigLinkline>(); // 링크 선을 저장한 리스트 자료구조
20 20
21 - // 변수를 클래스 밖에서 읽고 쓰게 하는 함수 21 + private FigBase _linkStartShape = null; // 처음 선택한 도형을 저장하는 변수
22 + private FigBase _movingShape = null; // 도형을 움직이겠다고 선택된 경우 해당 도형을 저장하는 변수
23 +
24 +
25 + // private 변수를 클래스 밖에서 읽고 쓰게 하는 함수
22 public string FigName { get { return _figName; } set { _figName = value; } } 26 public string FigName { get { return _figName; } set { _figName = value; } }
23 public String State { get { return _state; } set { _state = value; } } 27 public String State { get { return _state; } set { _state = value; } }
24 28
25 - // 마우스를 판넬에서 움질일때 호출되는 이벤트 29 + // 마우스를 판넬에서 움질일때 호출되는 이벤트 함수
26 protected override void OnMouseMove(MouseEventArgs e) 30 protected override void OnMouseMove(MouseEventArgs e)
27 { 31 {
28 - // System.Diagnostics.Trace.WriteLine("debug >>>" + e.Location); 32 + // System.Diagnostics.Trace.WriteLine("debug >>>" + _state); // 디버깅
33 +
29 // 마우스 버튼을 누르지 않은 상태일 경우 34 // 마우스 버튼을 누르지 않은 상태일 경우
30 - if (e.Button == MouseButtons.None ) 35 + if (e.Button == MouseButtons.None)
31 { 36 {
32 - bool find = false;
33 -
34 - foreach (FigBase s in _shapes)
35 - {
36 - // 현재 마우스 위치가 지금껏 그린 리스트 자료구조 안의 도형의 영역안에 있는지 확인
37 - if (s.PointInRegion(e.Location))
38 - {
39 - find = true;
40 - }
41 - }
42 // 그려진 도형위에 마우스가 오면 마우스 모양을 변경 37 // 그려진 도형위에 마우스가 오면 마우스 모양을 변경
43 - if (find) 38 + FigBase shape = FindShapeByLocation(e.Location);
44 - Cursor = Cursors.SizeAll; 39 +
40 + if (shape != null)
41 + Cursor = Cursors.SizeAll; // 도형 안에 마우스가 있을 경우
45 else 42 else
46 - Cursor = Cursors.Default; 43 + Cursor = Cursors.Default; // 도형 밖에 마우스 포인터가 있을 경우
44 +
45 + if (shape != null && _figName == "LINKLINE") // 링크 라인을 그리겠다고 선택하고, 도형 안에 마우스가 있을 경우
46 + Cursor = Cursors.Cross;
47 47
48 } 48 }
49 - // 마우스를 클릭했을때 49 + // 마우스를 클릭한 상태에서 링크 라인을 그리지 않겠다고 선택된 경우
50 - else if (e.Button == MouseButtons.Left) 50 + else if (e.Button == MouseButtons.Left && _figName != "LINKLINE")
51 { 51 {
52 - foreach (FigBase s in _shapes) 52 + FigBase shape = FindShapeByLocation(e.Location);
53 + if (shape != null)
53 { 54 {
54 - // 자료구조안의 위치와 동일할 경우 해당 자료구조를 다시 가져온다. 55 + _state = "MOVE"; // 움직이는 상태로 바꿈
55 - if (s.PointInRegion(e.Location)) 56 + _movingShape = shape; // 해당 도형을 레퍼런스
56 - {
57 - _findShape = s;
58 - break;
59 - }
60 } 57 }
61 - // 도형을 찾았으면 움직이는 상태로 변경 후, 현재 마우스 위치를 저장함. 58 + }
62 - if (_findShape != null) 59 + // 마우스를 클릭한 상태에서 링크 라인을 그리겠다고 선택한 경우
60 + else if (e.Button == MouseButtons.Left && _figName == "LINKLINE")
61 + {
62 + if (_linkStartShape == null) // 처음 도형을 선택한것만 저장하기 위함. (다른 영역의 도형으로 넘어가도 실행안함)
63 { 63 {
64 - State = "MOVE"; 64 + _linkStartShape = FindShapeByLocation(e.Location);
65 - _dragStartPoint = e.Location; 65 + if (_linkStartShape != null)
66 + {
67 + _state = "MOVE";
68 + }
66 } 69 }
67 } 70 }
68 71
...@@ -72,36 +75,58 @@ namespace flowchart ...@@ -72,36 +75,58 @@ namespace flowchart
72 // 실제 도형을 그리거나 이동하는 함수, 최종 OnPaint() 함수가 호출되어 실행됨 75 // 실제 도형을 그리거나 이동하는 함수, 최종 OnPaint() 함수가 호출되어 실행됨
73 protected override void OnMouseUp(MouseEventArgs e) 76 protected override void OnMouseUp(MouseEventArgs e)
74 { 77 {
78 + //System.Diagnostics.Trace.WriteLine("debug >>>" + _state);
75 // 그리기 상태 79 // 그리기 상태
76 - if (State == "DRAW") 80 + if (_state == "DRAW")
77 { 81 {
78 - 82 + if (_figName == "RECTANGLE")
79 - if (FigName == "RECTANGLE")
80 { 83 {
81 // 사각형에 대한 정보를 자료구조에 삽입한다. 84 // 사각형에 대한 정보를 자료구조에 삽입한다.
82 FigRectangle rectangle = new FigRectangle(e.Location, new System.Drawing.Size(100, 100)); 85 FigRectangle rectangle = new FigRectangle(e.Location, new System.Drawing.Size(100, 100));
83 _shapes.Add(rectangle); 86 _shapes.Add(rectangle);
84 } 87 }
85 - else if (FigName == "RHOMBUS") 88 + else if (_figName == "RHOMBUS")
86 { 89 {
87 FigRhombus rhombus = new FigRhombus(e.Location, new System.Drawing.Size(100, 100)); 90 FigRhombus rhombus = new FigRhombus(e.Location, new System.Drawing.Size(100, 100));
88 _shapes.Add(rhombus); 91 _shapes.Add(rhombus);
89 } 92 }
90 - else if (FigName == "TRIANGLE") 93 + else if (_figName == "PARALLELOGRAM")
91 { 94 {
92 - // TODO : 삼각형 그리기 95 + FigParallelogram parallelogram = new FigParallelogram(e.Location, new System.Drawing.Size(100, 100));
96 + _shapes.Add(parallelogram);
93 } 97 }
94 } 98 }
95 - // 움직이는 상태 99 + // 움직이는 상태이고 링크 라인을 그리지 않는 경우 (단순 도형 이동)
96 - else if (State == "MOVE") 100 + else if (_state == "MOVE" && _figName != "LINKLINE")
97 { 101 {
98 - if (_findShape != null) 102 + if (_movingShape != null)
99 { 103 {
100 - _findShape.Location = e.Location; 104 + _movingShape.Location = e.Location; // 찾은 도형의 위치값을 옮길위치로 수정
105 + }
106 + }
107 + // 움직이는 상태이고 링크 라인을 그리는 경우 (링크 라인을 긋는 경우)
108 + else if (_state == "MOVE" && _figName == "LINKLINE")
109 + {
110 + if (_linkStartShape != null)
111 + {
112 + FigBase shape = FindShapeByLocation(e.Location); // 마우스를 클릭을 놓은 위치에 도형이 있는지 확인
113 + if (shape == null)
114 + {
115 + MessageBox.Show(this, "해당 위치에 연결대상 도형이 없습니다.", "알림",
116 + MessageBoxButtons.OK, MessageBoxIcon.Information);
117 + _linkStartShape = null; // mouse move 이벤트 함수에서 한번은 실행하게 처리
118 + }
119 + else
120 + {
121 + FigLinkline linkLine = new FigLinkline(_linkStartShape, shape); // 처음 선택한 도형과 현재 도형에 링크 라인을 연결 함
122 + _linkLines.Add(linkLine);
123 + _linkStartShape = null; // mouse move 이벤트 함수에서 한번은 실행하게 처리
124 + }
125 +
101 } 126 }
102 } 127 }
103 128
104 - State = "NONE"; 129 + _state = "NONE";
105 this.Refresh(); // 다시 그리기 요청: OnPaint() 130 this.Refresh(); // 다시 그리기 요청: OnPaint()
106 base.OnMouseUp(e); 131 base.OnMouseUp(e);
107 } 132 }
...@@ -109,12 +134,31 @@ namespace flowchart ...@@ -109,12 +134,31 @@ namespace flowchart
109 // 실제 그리는 OnPaint를 통해 내가 작성한 Draw함수를 호출한다. 134 // 실제 그리는 OnPaint를 통해 내가 작성한 Draw함수를 호출한다.
110 protected override void OnPaint(PaintEventArgs e) 135 protected override void OnPaint(PaintEventArgs e)
111 { 136 {
137 + // 자료구조에 저장된 도형을 다시 그림
112 foreach (FigBase s in _shapes) 138 foreach (FigBase s in _shapes)
113 { 139 {
114 s.Draw(e.Graphics); 140 s.Draw(e.Graphics);
115 } 141 }
142 + // 자료구조에 저장된 링크라인을 다시 그림
143 + foreach (FigLinkline l in _linkLines)
144 + {
145 + l.Draw(e.Graphics);
146 + }
116 147
117 base.OnPaint(e); 148 base.OnPaint(e);
118 } 149 }
150 + // 현재 위치에 해당하는 도형을 자료구조에서 레퍼런스 함
151 + private FigBase FindShapeByLocation(Point location)
152 + {
153 + foreach (FigBase s in _shapes)
154 + {
155 + if (s.PointInRegion(location))
156 + {
157 + return s;
158 + }
159 + }
160 +
161 + return null;
162 + }
119 } 163 }
120 } 164 }
......
...@@ -8,22 +8,41 @@ using System.Threading.Tasks; ...@@ -8,22 +8,41 @@ using System.Threading.Tasks;
8 namespace flowchart 8 namespace flowchart
9 { 9 {
10 // flowchart 도형을 그리는 클래스의 공통(부모 클래스) 10 // flowchart 도형을 그리는 클래스의 공통(부모 클래스)
11 - // 변수: 위치(_location), 크기(_size) 11 + // 변수: 위치(_location), 크기(_size). 링크선 위치(_linkPoints)
12 - // 함수: 그리기(Draw) 12 + // 함수: 그리기(Draw), 영역내에 있는지 확인(PointInRegion)
13 class FigBase 13 class FigBase
14 { 14 {
15 private Point _location; // 위치 변수 15 private Point _location; // 위치 변수
16 private Size _size; // 크기 변수 16 private Size _size; // 크기 변수
17 + private Point[] _linkPoints = new Point[] { Point.Empty, Point.Empty, Point.Empty, Point.Empty }; // Top, Left, Bottom, Right
17 18
18 protected FigBase(Point location, Size size) // 생성자 (위치와 크기를 저장) 19 protected FigBase(Point location, Size size) // 생성자 (위치와 크기를 저장)
19 { 20 {
20 _location = location; 21 _location = location;
21 _size = size; 22 _size = size;
23 + CalculateLinkPoint();
22 } 24 }
23 25
24 - // 위치와 크기 변수의 값을 읽고 쓰는 함수 26 + // 내부 변수를 외부에서 접근하는 함수
25 - public Point Location { get => _location; set => _location = value; } 27 + public Point Location
26 - public Size Size { get => _size; set => _size = value; } 28 + {
29 + get => _location;
30 + set
31 + {
32 + _location = value;
33 + CalculateLinkPoint(); // 선을 연결하기 위해 도형 주위의 4개의 위치값을 재계산
34 + }
35 + }
36 + public Size Size
37 + {
38 + get => _size;
39 + set
40 + {
41 + _size = value;
42 + CalculateLinkPoint(); // 선을 연결하기 위해 도형 주위의 4개의 위치값을 재계산
43 + }
44 + }
45 + public Point[] LinkPoints { get => _linkPoints; set => _linkPoints = value; }
27 46
28 // 자식 클래스에 필요한 공통 함수 47 // 자식 클래스에 필요한 공통 함수
29 public virtual void Draw(Graphics g) 48 public virtual void Draw(Graphics g)
...@@ -38,5 +57,14 @@ namespace flowchart ...@@ -38,5 +57,14 @@ namespace flowchart
38 Rectangle rect = new Rectangle(_location, _size); 57 Rectangle rect = new Rectangle(_location, _size);
39 return rect.Contains(mousePoint); 58 return rect.Contains(mousePoint);
40 } 59 }
60 +
61 + // 도형의 주위의 4군데 위치를 저장
62 + private void CalculateLinkPoint()
63 + {
64 + _linkPoints[0] = new Point(_location.X + (int)(((float)_size.Width) / 2), _location.Y); // Top
65 + _linkPoints[1] = new Point(_location.X, _location.Y + (int)(((float)_size.Height) / 2)); // Left
66 + _linkPoints[2] = new Point(_location.X + (int)(((float)_size.Width) / 2), _location.Y + _size.Height); // Bottom
67 + _linkPoints[3] = new Point(_location.X + _size.Width, _location.Y + (int)(((float)_size.Height) / 2)); // Right
68 + }
41 } 69 }
42 } 70 }
......
1 +using System;
2 +using System.Collections.Generic;
3 +using System.Drawing;
4 +using System.Drawing.Drawing2D;
5 +using System.Linq;
6 +using System.Text;
7 +using System.Threading.Tasks;
8 +
9 +namespace flowchart
10 +{
11 + class FigLinkline
12 + {
13 + private FigBase _startShape; // 링크 라인의 시작 위치
14 + private FigBase _endShape; // 링크 라인의 종료 위치
15 +
16 + public FigLinkline(FigBase startShape, FigBase endShape)
17 + {
18 + _startShape = startShape;
19 + _endShape = endShape;
20 + }
21 +
22 + public void Draw(Graphics g)
23 + {
24 + using (Pen pen = new Pen(Color.Blue, 3f) { StartCap = LineCap.Round, EndCap = LineCap.Round })
25 + {
26 + Point[] pts = FindShortestLinkPoints(); // 두 도형의 최단거리를 계산하는 함수를 호출
27 +
28 + g.DrawLine(pen, pts[0], pts[1]); // 실제 링크 라인을 처리
29 + }
30 + }
31 +
32 + // 시작 도형의 4개 점과 종료 도형의 4개 점의 거리를 구해서 최단거리를 리턴한다.
33 + private Point[] FindShortestLinkPoints()
34 + {
35 + double distance = Double.MaxValue;
36 + Point[] results = new Point[] { Point.Empty, Point.Empty };
37 + foreach (Point p1 in _startShape.LinkPoints)
38 + {
39 + foreach (Point p2 in _endShape.LinkPoints)
40 + {
41 + double newDistance = GetDistance(p1, p2); // 두점의 거리를 구하는 함수를 호출
42 +
43 + if (newDistance < distance)
44 + {
45 + distance = newDistance;
46 + results[0] = p1;
47 + results[1] = p2;
48 + }
49 +
50 + }
51 + }
52 +
53 + return results;
54 + }
55 +
56 + // 주어진 두점의 거리만 구해서 리턴한다.
57 + private double GetDistance(Point pt1, Point pt2)
58 + {
59 + double temp = Math.Pow(pt2.X - pt1.X, 2) + Math.Pow(pt2.Y - pt1.Y, 2);
60 + return Math.Sqrt(temp);
61 + }
62 +
63 + }
64 +}
1 +
2 +namespace flowchart
3 +{
4 + partial class MainForm
5 + {
6 + /// <summary>
7 + /// 필수 디자이너 변수입니다.
8 + /// </summary>
9 + private System.ComponentModel.IContainer components = null;
10 +
11 + /// <summary>
12 + /// 사용 중인 모든 리소스를 정리합니다.
13 + /// </summary>
14 + /// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
15 + protected override void Dispose(bool disposing)
16 + {
17 + if (disposing && (components != null))
18 + {
19 + components.Dispose();
20 + }
21 + base.Dispose(disposing);
22 + }
23 +
24 + #region Windows Form 디자이너에서 생성한 코드
25 +
26 + /// <summary>
27 + /// 디자이너 지원에 필요한 메서드입니다.
28 + /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
29 + /// </summary>
30 + private void InitializeComponent()
31 + {
32 + this.btn_default = new System.Windows.Forms.Button();
33 + this.btn_rectangle = new System.Windows.Forms.Button();
34 + this.btn_rhombus = new System.Windows.Forms.Button();
35 + this.btn_linkline = new System.Windows.Forms.Button();
36 + this.CustomPanel = new flowchart.CustomPanel();
37 + this.btn_parallelogram = new System.Windows.Forms.Button();
38 + this.SuspendLayout();
39 + //
40 + // btn_default
41 + //
42 + this.btn_default.Location = new System.Drawing.Point(34, 33);
43 + this.btn_default.Name = "btn_default";
44 + this.btn_default.Size = new System.Drawing.Size(105, 31);
45 + this.btn_default.TabIndex = 0;
46 + this.btn_default.Text = "default";
47 + this.btn_default.UseVisualStyleBackColor = true;
48 + this.btn_default.Click += new System.EventHandler(this.btn_default_Click_1);
49 + //
50 + // btn_rectangle
51 + //
52 + this.btn_rectangle.Location = new System.Drawing.Point(34, 155);
53 + this.btn_rectangle.Name = "btn_rectangle";
54 + this.btn_rectangle.Size = new System.Drawing.Size(105, 31);
55 + this.btn_rectangle.TabIndex = 1;
56 + this.btn_rectangle.Text = "process";
57 + this.btn_rectangle.UseVisualStyleBackColor = true;
58 + this.btn_rectangle.Click += new System.EventHandler(this.btn_rectangle_Click_1);
59 + //
60 + // btn_rhombus
61 + //
62 + this.btn_rhombus.Location = new System.Drawing.Point(34, 201);
63 + this.btn_rhombus.Name = "btn_rhombus";
64 + this.btn_rhombus.Size = new System.Drawing.Size(105, 31);
65 + this.btn_rhombus.TabIndex = 2;
66 + this.btn_rhombus.Text = "if";
67 + this.btn_rhombus.UseVisualStyleBackColor = true;
68 + this.btn_rhombus.Click += new System.EventHandler(this.btn_rhombus_Click_1);
69 + //
70 + // btn_linkline
71 + //
72 + this.btn_linkline.Location = new System.Drawing.Point(34, 256);
73 + this.btn_linkline.Name = "btn_linkline";
74 + this.btn_linkline.Size = new System.Drawing.Size(105, 31);
75 + this.btn_linkline.TabIndex = 3;
76 + this.btn_linkline.Text = "link line";
77 + this.btn_linkline.UseVisualStyleBackColor = true;
78 + this.btn_linkline.Click += new System.EventHandler(this.btn_linkline_Click);
79 + //
80 + // CustomPanel
81 + //
82 + this.CustomPanel.BackColor = System.Drawing.SystemColors.ActiveBorder;
83 + this.CustomPanel.FigName = null;
84 + this.CustomPanel.Location = new System.Drawing.Point(174, 10);
85 + this.CustomPanel.Name = "CustomPanel";
86 + this.CustomPanel.Size = new System.Drawing.Size(707, 533);
87 + this.CustomPanel.State = null;
88 + this.CustomPanel.TabIndex = 0;
89 + //
90 + // btn_parallelogram
91 + //
92 + this.btn_parallelogram.Location = new System.Drawing.Point(34, 105);
93 + this.btn_parallelogram.Name = "btn_parallelogram";
94 + this.btn_parallelogram.Size = new System.Drawing.Size(105, 31);
95 + this.btn_parallelogram.TabIndex = 4;
96 + this.btn_parallelogram.Text = "input";
97 + this.btn_parallelogram.UseVisualStyleBackColor = true;
98 + this.btn_parallelogram.Click += new System.EventHandler(this.btn_parallelogram_Click);
99 + //
100 + // MainForm
101 + //
102 + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
103 + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
104 + this.ClientSize = new System.Drawing.Size(886, 547);
105 + this.Controls.Add(this.btn_parallelogram);
106 + this.Controls.Add(this.btn_linkline);
107 + this.Controls.Add(this.btn_rhombus);
108 + this.Controls.Add(this.btn_rectangle);
109 + this.Controls.Add(this.btn_default);
110 + this.Controls.Add(this.CustomPanel);
111 + this.Name = "MainForm";
112 + this.Text = "flowchart";
113 + this.ResumeLayout(false);
114 +
115 + }
116 +
117 + #endregion
118 +
119 + private CustomPanel CustomPanel;
120 + private System.Windows.Forms.Button btn_default;
121 + private System.Windows.Forms.Button btn_rectangle;
122 + private System.Windows.Forms.Button btn_rhombus;
123 + private System.Windows.Forms.Button btn_linkline;
124 + private System.Windows.Forms.Button btn_parallelogram;
125 + }
126 +}
127 +
...@@ -17,25 +17,42 @@ namespace flowchart ...@@ -17,25 +17,42 @@ namespace flowchart
17 InitializeComponent(); 17 InitializeComponent();
18 } 18 }
19 19
20 - private void btn_default_Click(object sender, EventArgs e) 20 + private void btn_default_Click_1(object sender, EventArgs e)
21 { 21 {
22 + // 초기상태
22 CustomPanel.State = "NONE"; 23 CustomPanel.State = "NONE";
23 - CustomPanel.FigName = "NONE"; 24 + CustomPanel.FigName = "NONE";
24 CustomPanel.Cursor = Cursors.Default; 25 CustomPanel.Cursor = Cursors.Default;
25 } 26 }
26 27
27 - private void btn_rectangle_Click(object sender, EventArgs e) 28 + private void btn_rectangle_Click_1(object sender, EventArgs e)
28 { 29 {
29 CustomPanel.State = "DRAW"; // 도형을 그리겠다고 선택 30 CustomPanel.State = "DRAW"; // 도형을 그리겠다고 선택
30 CustomPanel.FigName = "RECTANGLE"; // 사각형을 선택 31 CustomPanel.FigName = "RECTANGLE"; // 사각형을 선택
31 CustomPanel.Cursor = Cursors.Hand; 32 CustomPanel.Cursor = Cursors.Hand;
32 } 33 }
33 34
34 - private void btn_rhombus_Click(object sender, EventArgs e) 35 +
36 +
37 + private void btn_rhombus_Click_1(object sender, EventArgs e)
35 { 38 {
36 CustomPanel.State = "DRAW"; 39 CustomPanel.State = "DRAW";
37 - CustomPanel.FigName = "RHOMBUS"; 40 + CustomPanel.FigName = "RHOMBUS"; // 마름모를 선택
41 + CustomPanel.Cursor = Cursors.Hand;
42 + }
43 +
44 + private void btn_parallelogram_Click(object sender, EventArgs e)
45 + {
46 + CustomPanel.State = "DRAW";
47 + CustomPanel.FigName = "PARALLELOGRAM"; // 사각형을 선택
38 CustomPanel.Cursor = Cursors.Hand; 48 CustomPanel.Cursor = Cursors.Hand;
39 } 49 }
50 +
51 + private void btn_linkline_Click(object sender, EventArgs e)
52 + {
53 + CustomPanel.State = "DRAW";
54 + CustomPanel.FigName = "LINKLINE"; // 링크 라인을 선택
55 + // CustomPanel.Cursor = Cursors.Hand;
56 + }
40 } 57 }
41 } 58 }
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<root>
3 + <!--
4 + Microsoft ResX Schema
5 +
6 + Version 2.0
7 +
8 + The primary goals of this format is to allow a simple XML format
9 + that is mostly human readable. The generation and parsing of the
10 + various data types are done through the TypeConverter classes
11 + associated with the data types.
12 +
13 + Example:
14 +
15 + ... ado.net/XML headers & schema ...
16 + <resheader name="resmimetype">text/microsoft-resx</resheader>
17 + <resheader name="version">2.0</resheader>
18 + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19 + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20 + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21 + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22 + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23 + <value>[base64 mime encoded serialized .NET Framework object]</value>
24 + </data>
25 + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26 + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27 + <comment>This is a comment</comment>
28 + </data>
29 +
30 + There are any number of "resheader" rows that contain simple
31 + name/value pairs.
32 +
33 + Each data row contains a name, and value. The row also contains a
34 + type or mimetype. Type corresponds to a .NET class that support
35 + text/value conversion through the TypeConverter architecture.
36 + Classes that don't support this are serialized and stored with the
37 + mimetype set.
38 +
39 + The mimetype is used for serialized objects, and tells the
40 + ResXResourceReader how to depersist the object. This is currently not
41 + extensible. For a given mimetype the value must be set accordingly:
42 +
43 + Note - application/x-microsoft.net.object.binary.base64 is the format
44 + that the ResXResourceWriter will generate, however the reader can
45 + read any of the formats listed below.
46 +
47 + mimetype: application/x-microsoft.net.object.binary.base64
48 + value : The object must be serialized with
49 + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50 + : and then encoded with base64 encoding.
51 +
52 + mimetype: application/x-microsoft.net.object.soap.base64
53 + value : The object must be serialized with
54 + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55 + : and then encoded with base64 encoding.
56 +
57 + mimetype: application/x-microsoft.net.object.bytearray.base64
58 + value : The object must be serialized into a byte array
59 + : using a System.ComponentModel.TypeConverter
60 + : and then encoded with base64 encoding.
61 + -->
62 + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63 + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64 + <xsd:element name="root" msdata:IsDataSet="true">
65 + <xsd:complexType>
66 + <xsd:choice maxOccurs="unbounded">
67 + <xsd:element name="metadata">
68 + <xsd:complexType>
69 + <xsd:sequence>
70 + <xsd:element name="value" type="xsd:string" minOccurs="0" />
71 + </xsd:sequence>
72 + <xsd:attribute name="name" use="required" type="xsd:string" />
73 + <xsd:attribute name="type" type="xsd:string" />
74 + <xsd:attribute name="mimetype" type="xsd:string" />
75 + <xsd:attribute ref="xml:space" />
76 + </xsd:complexType>
77 + </xsd:element>
78 + <xsd:element name="assembly">
79 + <xsd:complexType>
80 + <xsd:attribute name="alias" type="xsd:string" />
81 + <xsd:attribute name="name" type="xsd:string" />
82 + </xsd:complexType>
83 + </xsd:element>
84 + <xsd:element name="data">
85 + <xsd:complexType>
86 + <xsd:sequence>
87 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88 + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89 + </xsd:sequence>
90 + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91 + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92 + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93 + <xsd:attribute ref="xml:space" />
94 + </xsd:complexType>
95 + </xsd:element>
96 + <xsd:element name="resheader">
97 + <xsd:complexType>
98 + <xsd:sequence>
99 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100 + </xsd:sequence>
101 + <xsd:attribute name="name" type="xsd:string" use="required" />
102 + </xsd:complexType>
103 + </xsd:element>
104 + </xsd:choice>
105 + </xsd:complexType>
106 + </xsd:element>
107 + </xsd:schema>
108 + <resheader name="resmimetype">
109 + <value>text/microsoft-resx</value>
110 + </resheader>
111 + <resheader name="version">
112 + <value>2.0</value>
113 + </resheader>
114 + <resheader name="reader">
115 + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116 + </resheader>
117 + <resheader name="writer">
118 + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 + </resheader>
120 +</root>
...\ No newline at end of file ...\ No newline at end of file
1 +using System;
2 +using System.Collections.Generic;
3 +using System.Linq;
4 +using System.Threading.Tasks;
5 +using System.Windows.Forms;
6 +
7 +namespace flowchart
8 +{
9 + static class Program
10 + {
11 + /// <summary>
12 + /// 해당 애플리케이션의 주 진입점입니다.
13 + /// </summary>
14 + [STAThread]
15 + static void Main()
16 + {
17 + Application.EnableVisualStyles();
18 + Application.SetCompatibleTextRenderingDefault(false);
19 + Application.Run(new MainForm());
20 + }
21 + }
22 +}
No preview for this file type
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4 + <PropertyGroup>
5 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7 + <ProjectGuid>{F36248FE-508D-4E52-8992-8C170EC01E16}</ProjectGuid>
8 + <OutputType>WinExe</OutputType>
9 + <RootNamespace>flowchart</RootNamespace>
10 + <AssemblyName>flowchart</AssemblyName>
11 + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12 + <FileAlignment>512</FileAlignment>
13 + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14 + <Deterministic>true</Deterministic>
15 + </PropertyGroup>
16 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17 + <PlatformTarget>AnyCPU</PlatformTarget>
18 + <DebugSymbols>true</DebugSymbols>
19 + <DebugType>full</DebugType>
20 + <Optimize>false</Optimize>
21 + <OutputPath>bin\Debug\</OutputPath>
22 + <DefineConstants>DEBUG;TRACE</DefineConstants>
23 + <ErrorReport>prompt</ErrorReport>
24 + <WarningLevel>4</WarningLevel>
25 + </PropertyGroup>
26 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27 + <PlatformTarget>AnyCPU</PlatformTarget>
28 + <DebugType>pdbonly</DebugType>
29 + <Optimize>true</Optimize>
30 + <OutputPath>bin\Release\</OutputPath>
31 + <DefineConstants>TRACE</DefineConstants>
32 + <ErrorReport>prompt</ErrorReport>
33 + <WarningLevel>4</WarningLevel>
34 + </PropertyGroup>
35 + <ItemGroup>
36 + <Reference Include="System" />
37 + <Reference Include="System.Core" />
38 + <Reference Include="System.Xml.Linq" />
39 + <Reference Include="System.Data.DataSetExtensions" />
40 + <Reference Include="Microsoft.CSharp" />
41 + <Reference Include="System.Data" />
42 + <Reference Include="System.Deployment" />
43 + <Reference Include="System.Drawing" />
44 + <Reference Include="System.Net.Http" />
45 + <Reference Include="System.Windows.Forms" />
46 + <Reference Include="System.Xml" />
47 + </ItemGroup>
48 + <ItemGroup>
49 + <Compile Include="CustomPanel.cs">
50 + <SubType>Component</SubType>
51 + </Compile>
52 + <Compile Include="FigBase.cs" />
53 + <Compile Include="FigLinkline.cs" />
54 + <Compile Include="FigParallelogram.cs" />
55 + <Compile Include="FigRectangle.cs" />
56 + <Compile Include="FigRhombus.cs" />
57 + <Compile Include="MainForm.cs">
58 + <SubType>Form</SubType>
59 + </Compile>
60 + <Compile Include="MainForm.Designer.cs">
61 + <DependentUpon>MainForm.cs</DependentUpon>
62 + </Compile>
63 + <Compile Include="Program.cs" />
64 + <Compile Include="Properties\AssemblyInfo.cs" />
65 + <EmbeddedResource Include="MainForm.resx">
66 + <DependentUpon>MainForm.cs</DependentUpon>
67 + </EmbeddedResource>
68 + <EmbeddedResource Include="Properties\Resources.resx">
69 + <Generator>ResXFileCodeGenerator</Generator>
70 + <LastGenOutput>Resources.Designer.cs</LastGenOutput>
71 + <SubType>Designer</SubType>
72 + </EmbeddedResource>
73 + <Compile Include="Properties\Resources.Designer.cs">
74 + <AutoGen>True</AutoGen>
75 + <DependentUpon>Resources.resx</DependentUpon>
76 + </Compile>
77 + <None Include="Properties\Settings.settings">
78 + <Generator>SettingsSingleFileGenerator</Generator>
79 + <LastGenOutput>Settings.Designer.cs</LastGenOutput>
80 + </None>
81 + <Compile Include="Properties\Settings.Designer.cs">
82 + <AutoGen>True</AutoGen>
83 + <DependentUpon>Settings.settings</DependentUpon>
84 + <DesignTimeSharedInput>True</DesignTimeSharedInput>
85 + </Compile>
86 + </ItemGroup>
87 + <ItemGroup>
88 + <None Include="App.config" />
89 + </ItemGroup>
90 + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
91 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +
2 +Microsoft Visual Studio Solution File, Format Version 12.00
3 +# Visual Studio Version 16
4 +VisualStudioVersion = 16.0.31313.79
5 +MinimumVisualStudioVersion = 10.0.40219.1
6 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "flowchart", "flowchart.csproj", "{F36248FE-508D-4E52-8992-8C170EC01E16}"
7 +EndProject
8 +Global
9 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 + Debug|Any CPU = Debug|Any CPU
11 + Release|Any CPU = Release|Any CPU
12 + EndGlobalSection
13 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 + {F36248FE-508D-4E52-8992-8C170EC01E16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 + {F36248FE-508D-4E52-8992-8C170EC01E16}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 + {F36248FE-508D-4E52-8992-8C170EC01E16}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 + {F36248FE-508D-4E52-8992-8C170EC01E16}.Release|Any CPU.Build.0 = Release|Any CPU
18 + EndGlobalSection
19 + GlobalSection(SolutionProperties) = preSolution
20 + HideSolutionNode = FALSE
21 + EndGlobalSection
22 + GlobalSection(ExtensibilityGlobals) = postSolution
23 + SolutionGuid = {E647181D-3CFB-4ED2-9BA3-1BA9C663CD8D}
24 + EndGlobalSection
25 +EndGlobal