Showing
7 changed files
with
69 additions
and
12 deletions
... | @@ -11,7 +11,7 @@ namespace flowchart | ... | @@ -11,7 +11,7 @@ namespace flowchart |
11 | // 각종 선택 상황을 열거형으로 정의 | 11 | // 각종 선택 상황을 열거형으로 정의 |
12 | public enum State | 12 | public enum State |
13 | { | 13 | { |
14 | - NONE, RECTANGLE, RHOMBUS, PARALLELOGRAM, LINKLINE, MOVE | 14 | + NONE, RECTANGLE, RHOMBUS, PARALLELOGRAM, LINKLINE, ELLIPSE, MOVE |
15 | } | 15 | } |
16 | 16 | ||
17 | 17 | ||
... | @@ -90,19 +90,24 @@ namespace flowchart | ... | @@ -90,19 +90,24 @@ namespace flowchart |
90 | if (_selectState == State.RECTANGLE) // 사각형 그리기 선택 | 90 | if (_selectState == State.RECTANGLE) // 사각형 그리기 선택 |
91 | { | 91 | { |
92 | // 사각형에 대한 정보를 자료구조에 삽입한다. | 92 | // 사각형에 대한 정보를 자료구조에 삽입한다. |
93 | - FigRectangle rectangle = new FigRectangle(e.Location, new System.Drawing.Size(100, 100)); | 93 | + FigRectangle rectangle = new FigRectangle(e.Location, new System.Drawing.Size(100, 50)); |
94 | _shapes.Add(rectangle); | 94 | _shapes.Add(rectangle); |
95 | } | 95 | } |
96 | else if (_selectState == State.RHOMBUS) // 마름모 그리기 선택 | 96 | else if (_selectState == State.RHOMBUS) // 마름모 그리기 선택 |
97 | { | 97 | { |
98 | - FigRhombus rhombus = new FigRhombus(e.Location, new System.Drawing.Size(100, 100)); | 98 | + FigRhombus rhombus = new FigRhombus(e.Location, new System.Drawing.Size(100, 50)); |
99 | _shapes.Add(rhombus); | 99 | _shapes.Add(rhombus); |
100 | } | 100 | } |
101 | else if (_selectState == State.PARALLELOGRAM) // 평행사변형 그리기 선택 | 101 | else if (_selectState == State.PARALLELOGRAM) // 평행사변형 그리기 선택 |
102 | { | 102 | { |
103 | - FigParallelogram parallelogram = new FigParallelogram(e.Location, new System.Drawing.Size(100, 100)); | 103 | + FigParallelogram parallelogram = new FigParallelogram(e.Location, new System.Drawing.Size(100, 50)); |
104 | _shapes.Add(parallelogram); | 104 | _shapes.Add(parallelogram); |
105 | } | 105 | } |
106 | + else if (_selectState == State.ELLIPSE) // 원형 그리기 선택 | ||
107 | + { | ||
108 | + FigEllipse ellipse = new FigEllipse(e.Location, new System.Drawing.Size(100, 50)); | ||
109 | + _shapes.Add(ellipse); | ||
110 | + } | ||
106 | else if (_selectState == State.MOVE) // 도형을 움직이는 상태로 선택한 경우 | 111 | else if (_selectState == State.MOVE) // 도형을 움직이는 상태로 선택한 경우 |
107 | { | 112 | { |
108 | if (_movingShape != null) | 113 | if (_movingShape != null) | ... | ... |
... | @@ -51,7 +51,7 @@ namespace flowchart | ... | @@ -51,7 +51,7 @@ namespace flowchart |
51 | CalculateTextArea(); | 51 | CalculateTextArea(); |
52 | } | 52 | } |
53 | } | 53 | } |
54 | - public Point[] LinkPoints { get => _linkPoints; set => _linkPoints = value; } | 54 | + public Point[] LinkPoints { get => _linkPoints; set => _linkPoints = value; } // FigLinkline에서 호출됨 |
55 | 55 | ||
56 | // 자식 클래스에 필요한 공통 함수 | 56 | // 자식 클래스에 필요한 공통 함수 |
57 | public virtual void Draw(Graphics g) | 57 | public virtual void Draw(Graphics g) |
... | @@ -67,14 +67,12 @@ namespace flowchart | ... | @@ -67,14 +67,12 @@ namespace flowchart |
67 | } | 67 | } |
68 | 68 | ||
69 | } | 69 | } |
70 | - | ||
71 | // 현재 마우스의 위치가 해당 영역내에 있는지를 판단하는 함수 | 70 | // 현재 마우스의 위치가 해당 영역내에 있는지를 판단하는 함수 |
72 | public virtual bool PointInRegion(Point mousePoint) | 71 | public virtual bool PointInRegion(Point mousePoint) |
73 | { | 72 | { |
74 | Rectangle rect = new Rectangle(_location, _size); | 73 | Rectangle rect = new Rectangle(_location, _size); |
75 | return rect.Contains(mousePoint); | 74 | return rect.Contains(mousePoint); |
76 | } | 75 | } |
77 | - | ||
78 | // 도형의 주위의 4군데 위치를 저장 | 76 | // 도형의 주위의 4군데 위치를 저장 |
79 | private void CalculateLinkPoint() | 77 | private void CalculateLinkPoint() |
80 | { | 78 | { | ... | ... |
FigEllipse.cs
0 → 100644
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Drawing; | ||
4 | +using System.Linq; | ||
5 | +using System.Text; | ||
6 | +using System.Threading.Tasks; | ||
7 | + | ||
8 | +namespace flowchart | ||
9 | +{ | ||
10 | + // 프로세스 원을 그리는 클래스(FigureBase를 상속) | ||
11 | + // Draw 함수에서 원을 그린다. | ||
12 | + class FigEllipse : FigBase | ||
13 | + { | ||
14 | + // 생성자도 상속해서 사용. | ||
15 | + public FigEllipse(Point location, Size size) : base(location, size) | ||
16 | + { | ||
17 | + | ||
18 | + } | ||
19 | + | ||
20 | + public override void Draw(Graphics g) | ||
21 | + { | ||
22 | + using (Pen pen = new Pen(Color.Red, 1)) | ||
23 | + { | ||
24 | + System.Drawing.Rectangle rect = new System.Drawing.Rectangle(this.Location, this.Size); | ||
25 | + g.DrawEllipse(pen, rect); // 원을 그리는 함수 | ||
26 | + | ||
27 | + | ||
28 | + } | ||
29 | + | ||
30 | + base.Draw(g); | ||
31 | + } | ||
32 | + } | ||
33 | +} |
... | @@ -35,6 +35,7 @@ namespace flowchart | ... | @@ -35,6 +35,7 @@ namespace flowchart |
35 | this.btn_linkline = new System.Windows.Forms.Button(); | 35 | this.btn_linkline = new System.Windows.Forms.Button(); |
36 | this.CustomPanel = new flowchart.CustomPanel(); | 36 | this.CustomPanel = new flowchart.CustomPanel(); |
37 | this.btn_parallelogram = new System.Windows.Forms.Button(); | 37 | this.btn_parallelogram = new System.Windows.Forms.Button(); |
38 | + this.btn_ellipse = new System.Windows.Forms.Button(); | ||
38 | this.SuspendLayout(); | 39 | this.SuspendLayout(); |
39 | // | 40 | // |
40 | // btn_default | 41 | // btn_default |
... | @@ -49,7 +50,7 @@ namespace flowchart | ... | @@ -49,7 +50,7 @@ namespace flowchart |
49 | // | 50 | // |
50 | // btn_rectangle | 51 | // btn_rectangle |
51 | // | 52 | // |
52 | - this.btn_rectangle.Location = new System.Drawing.Point(34, 155); | 53 | + this.btn_rectangle.Location = new System.Drawing.Point(34, 261); |
53 | this.btn_rectangle.Name = "btn_rectangle"; | 54 | this.btn_rectangle.Name = "btn_rectangle"; |
54 | this.btn_rectangle.Size = new System.Drawing.Size(105, 31); | 55 | this.btn_rectangle.Size = new System.Drawing.Size(105, 31); |
55 | this.btn_rectangle.TabIndex = 1; | 56 | this.btn_rectangle.TabIndex = 1; |
... | @@ -59,7 +60,7 @@ namespace flowchart | ... | @@ -59,7 +60,7 @@ namespace flowchart |
59 | // | 60 | // |
60 | // btn_rhombus | 61 | // btn_rhombus |
61 | // | 62 | // |
62 | - this.btn_rhombus.Location = new System.Drawing.Point(34, 201); | 63 | + this.btn_rhombus.Location = new System.Drawing.Point(34, 312); |
63 | this.btn_rhombus.Name = "btn_rhombus"; | 64 | this.btn_rhombus.Name = "btn_rhombus"; |
64 | this.btn_rhombus.Size = new System.Drawing.Size(105, 31); | 65 | this.btn_rhombus.Size = new System.Drawing.Size(105, 31); |
65 | this.btn_rhombus.TabIndex = 2; | 66 | this.btn_rhombus.TabIndex = 2; |
... | @@ -69,7 +70,7 @@ namespace flowchart | ... | @@ -69,7 +70,7 @@ namespace flowchart |
69 | // | 70 | // |
70 | // btn_linkline | 71 | // btn_linkline |
71 | // | 72 | // |
72 | - this.btn_linkline.Location = new System.Drawing.Point(34, 256); | 73 | + this.btn_linkline.Location = new System.Drawing.Point(34, 363); |
73 | this.btn_linkline.Name = "btn_linkline"; | 74 | this.btn_linkline.Name = "btn_linkline"; |
74 | this.btn_linkline.Size = new System.Drawing.Size(105, 31); | 75 | this.btn_linkline.Size = new System.Drawing.Size(105, 31); |
75 | this.btn_linkline.TabIndex = 3; | 76 | this.btn_linkline.TabIndex = 3; |
... | @@ -82,24 +83,36 @@ namespace flowchart | ... | @@ -82,24 +83,36 @@ namespace flowchart |
82 | this.CustomPanel.BackColor = System.Drawing.SystemColors.ActiveBorder; | 83 | this.CustomPanel.BackColor = System.Drawing.SystemColors.ActiveBorder; |
83 | this.CustomPanel.Location = new System.Drawing.Point(174, 10); | 84 | this.CustomPanel.Location = new System.Drawing.Point(174, 10); |
84 | this.CustomPanel.Name = "CustomPanel"; | 85 | this.CustomPanel.Name = "CustomPanel"; |
86 | + this.CustomPanel.SelectState = flowchart.State.NONE; | ||
85 | this.CustomPanel.Size = new System.Drawing.Size(707, 533); | 87 | this.CustomPanel.Size = new System.Drawing.Size(707, 533); |
86 | this.CustomPanel.TabIndex = 0; | 88 | this.CustomPanel.TabIndex = 0; |
87 | // | 89 | // |
88 | // btn_parallelogram | 90 | // btn_parallelogram |
89 | // | 91 | // |
90 | - this.btn_parallelogram.Location = new System.Drawing.Point(34, 105); | 92 | + this.btn_parallelogram.Location = new System.Drawing.Point(34, 201); |
91 | this.btn_parallelogram.Name = "btn_parallelogram"; | 93 | this.btn_parallelogram.Name = "btn_parallelogram"; |
92 | this.btn_parallelogram.Size = new System.Drawing.Size(105, 31); | 94 | this.btn_parallelogram.Size = new System.Drawing.Size(105, 31); |
93 | this.btn_parallelogram.TabIndex = 4; | 95 | this.btn_parallelogram.TabIndex = 4; |
94 | - this.btn_parallelogram.Text = "input"; | 96 | + this.btn_parallelogram.Text = "read"; |
95 | this.btn_parallelogram.UseVisualStyleBackColor = true; | 97 | this.btn_parallelogram.UseVisualStyleBackColor = true; |
96 | this.btn_parallelogram.Click += new System.EventHandler(this.btn_parallelogram_Click); | 98 | this.btn_parallelogram.Click += new System.EventHandler(this.btn_parallelogram_Click); |
97 | // | 99 | // |
100 | + // btn_ellipse | ||
101 | + // | ||
102 | + this.btn_ellipse.Location = new System.Drawing.Point(34, 145); | ||
103 | + this.btn_ellipse.Name = "btn_ellipse"; | ||
104 | + this.btn_ellipse.Size = new System.Drawing.Size(105, 31); | ||
105 | + this.btn_ellipse.TabIndex = 5; | ||
106 | + this.btn_ellipse.Text = "start"; | ||
107 | + this.btn_ellipse.UseVisualStyleBackColor = true; | ||
108 | + this.btn_ellipse.Click += new System.EventHandler(this.btn_ellipse_Click); | ||
109 | + // | ||
98 | // MainForm | 110 | // MainForm |
99 | // | 111 | // |
100 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); | 112 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); |
101 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | 113 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
102 | this.ClientSize = new System.Drawing.Size(886, 547); | 114 | this.ClientSize = new System.Drawing.Size(886, 547); |
115 | + this.Controls.Add(this.btn_ellipse); | ||
103 | this.Controls.Add(this.btn_parallelogram); | 116 | this.Controls.Add(this.btn_parallelogram); |
104 | this.Controls.Add(this.btn_linkline); | 117 | this.Controls.Add(this.btn_linkline); |
105 | this.Controls.Add(this.btn_rhombus); | 118 | this.Controls.Add(this.btn_rhombus); |
... | @@ -120,6 +133,7 @@ namespace flowchart | ... | @@ -120,6 +133,7 @@ namespace flowchart |
120 | private System.Windows.Forms.Button btn_rhombus; | 133 | private System.Windows.Forms.Button btn_rhombus; |
121 | private System.Windows.Forms.Button btn_linkline; | 134 | private System.Windows.Forms.Button btn_linkline; |
122 | private System.Windows.Forms.Button btn_parallelogram; | 135 | private System.Windows.Forms.Button btn_parallelogram; |
136 | + private System.Windows.Forms.Button btn_ellipse; | ||
123 | } | 137 | } |
124 | } | 138 | } |
125 | 139 | ... | ... |
... | @@ -40,9 +40,15 @@ namespace flowchart | ... | @@ -40,9 +40,15 @@ namespace flowchart |
40 | CustomPanel.SelectState = State.PARALLELOGRAM; // 평행사변형을 선택 | 40 | CustomPanel.SelectState = State.PARALLELOGRAM; // 평행사변형을 선택 |
41 | CustomPanel.Cursor = Cursors.Hand; // 마우스 모양은 손모양 | 41 | CustomPanel.Cursor = Cursors.Hand; // 마우스 모양은 손모양 |
42 | } | 42 | } |
43 | + private void btn_ellipse_Click(object sender, EventArgs e) | ||
44 | + { | ||
45 | + CustomPanel.SelectState = State.ELLIPSE; | ||
46 | + } | ||
43 | private void btn_linkline_Click(object sender, EventArgs e) | 47 | private void btn_linkline_Click(object sender, EventArgs e) |
44 | { | 48 | { |
45 | CustomPanel.SelectState = State.LINKLINE; // 링크 라인을 선택 | 49 | CustomPanel.SelectState = State.LINKLINE; // 링크 라인을 선택 |
46 | } | 50 | } |
51 | + | ||
52 | + | ||
47 | } | 53 | } |
48 | } | 54 | } | ... | ... |
... | @@ -54,6 +54,7 @@ | ... | @@ -54,6 +54,7 @@ |
54 | <Compile Include="FigParallelogram.cs" /> | 54 | <Compile Include="FigParallelogram.cs" /> |
55 | <Compile Include="FigRectangle.cs" /> | 55 | <Compile Include="FigRectangle.cs" /> |
56 | <Compile Include="FigRhombus.cs" /> | 56 | <Compile Include="FigRhombus.cs" /> |
57 | + <Compile Include="FigEllipse.cs" /> | ||
57 | <Compile Include="MainForm.cs"> | 58 | <Compile Include="MainForm.cs"> |
58 | <SubType>Form</SubType> | 59 | <SubType>Form</SubType> |
59 | </Compile> | 60 | </Compile> | ... | ... |
flowchart.exe
0 → 100644
No preview for this file type
-
Please register or login to post a comment