Toggle navigation
Toggle navigation
This project
Loading...
Sign in
남윤형
/
flowchart_draw
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
남윤형
2021-06-06 19:43:48 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6c56bdb26008bd1259b1d154a497d10a05a835e2
6c56bdb2
1 parent
b8bd7d2c
시작 종료 동그라미 구현 및 도형의 높이를 조정
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
12 deletions
CustomPanel.cs
FigBase.cs
FigEllipse.cs
MainForm.Designer.cs
MainForm.cs
flowchart.csproj
flowchart.exe
CustomPanel.cs
View file @
6c56bdb
...
...
@@ -11,7 +11,7 @@ namespace flowchart
// 각종 선택 상황을 열거형으로 정의
public
enum
State
{
NONE
,
RECTANGLE
,
RHOMBUS
,
PARALLELOGRAM
,
LINKLINE
,
MOVE
NONE
,
RECTANGLE
,
RHOMBUS
,
PARALLELOGRAM
,
LINKLINE
,
ELLIPSE
,
MOVE
}
...
...
@@ -90,19 +90,24 @@ namespace flowchart
if
(
_selectState
==
State
.
RECTANGLE
)
// 사각형 그리기 선택
{
// 사각형에 대한 정보를 자료구조에 삽입한다.
FigRectangle
rectangle
=
new
FigRectangle
(
e
.
Location
,
new
System
.
Drawing
.
Size
(
100
,
10
0
));
FigRectangle
rectangle
=
new
FigRectangle
(
e
.
Location
,
new
System
.
Drawing
.
Size
(
100
,
5
0
));
_shapes
.
Add
(
rectangle
);
}
else
if
(
_selectState
==
State
.
RHOMBUS
)
// 마름모 그리기 선택
{
FigRhombus
rhombus
=
new
FigRhombus
(
e
.
Location
,
new
System
.
Drawing
.
Size
(
100
,
10
0
));
FigRhombus
rhombus
=
new
FigRhombus
(
e
.
Location
,
new
System
.
Drawing
.
Size
(
100
,
5
0
));
_shapes
.
Add
(
rhombus
);
}
else
if
(
_selectState
==
State
.
PARALLELOGRAM
)
// 평행사변형 그리기 선택
{
FigParallelogram
parallelogram
=
new
FigParallelogram
(
e
.
Location
,
new
System
.
Drawing
.
Size
(
100
,
10
0
));
FigParallelogram
parallelogram
=
new
FigParallelogram
(
e
.
Location
,
new
System
.
Drawing
.
Size
(
100
,
5
0
));
_shapes
.
Add
(
parallelogram
);
}
else
if
(
_selectState
==
State
.
ELLIPSE
)
// 원형 그리기 선택
{
FigEllipse
ellipse
=
new
FigEllipse
(
e
.
Location
,
new
System
.
Drawing
.
Size
(
100
,
50
));
_shapes
.
Add
(
ellipse
);
}
else
if
(
_selectState
==
State
.
MOVE
)
// 도형을 움직이는 상태로 선택한 경우
{
if
(
_movingShape
!=
null
)
...
...
FigBase.cs
View file @
6c56bdb
...
...
@@ -51,7 +51,7 @@ namespace flowchart
CalculateTextArea
();
}
}
public
Point
[]
LinkPoints
{
get
=>
_linkPoints
;
set
=>
_linkPoints
=
value
;
}
public
Point
[]
LinkPoints
{
get
=>
_linkPoints
;
set
=>
_linkPoints
=
value
;
}
// FigLinkline에서 호출됨
// 자식 클래스에 필요한 공통 함수
public
virtual
void
Draw
(
Graphics
g
)
...
...
@@ -67,14 +67,12 @@ namespace flowchart
}
}
// 현재 마우스의 위치가 해당 영역내에 있는지를 판단하는 함수
public
virtual
bool
PointInRegion
(
Point
mousePoint
)
{
Rectangle
rect
=
new
Rectangle
(
_location
,
_size
);
return
rect
.
Contains
(
mousePoint
);
}
// 도형의 주위의 4군데 위치를 저장
private
void
CalculateLinkPoint
()
{
...
...
FigEllipse.cs
0 → 100644
View file @
6c56bdb
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
flowchart
{
// 프로세스 원을 그리는 클래스(FigureBase를 상속)
// Draw 함수에서 원을 그린다.
class
FigEllipse
:
FigBase
{
// 생성자도 상속해서 사용.
public
FigEllipse
(
Point
location
,
Size
size
)
:
base
(
location
,
size
)
{
}
public
override
void
Draw
(
Graphics
g
)
{
using
(
Pen
pen
=
new
Pen
(
Color
.
Red
,
1
))
{
System
.
Drawing
.
Rectangle
rect
=
new
System
.
Drawing
.
Rectangle
(
this
.
Location
,
this
.
Size
);
g
.
DrawEllipse
(
pen
,
rect
);
// 원을 그리는 함수
}
base
.
Draw
(
g
);
}
}
}
MainForm.Designer.cs
View file @
6c56bdb
...
...
@@ -35,6 +35,7 @@ namespace flowchart
this
.
btn_linkline
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
CustomPanel
=
new
flowchart
.
CustomPanel
();
this
.
btn_parallelogram
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_ellipse
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
SuspendLayout
();
//
// btn_default
...
...
@@ -49,7 +50,7 @@ namespace flowchart
//
// btn_rectangle
//
this
.
btn_rectangle
.
Location
=
new
System
.
Drawing
.
Point
(
34
,
155
);
this
.
btn_rectangle
.
Location
=
new
System
.
Drawing
.
Point
(
34
,
261
);
this
.
btn_rectangle
.
Name
=
"btn_rectangle"
;
this
.
btn_rectangle
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
31
);
this
.
btn_rectangle
.
TabIndex
=
1
;
...
...
@@ -59,7 +60,7 @@ namespace flowchart
//
// btn_rhombus
//
this
.
btn_rhombus
.
Location
=
new
System
.
Drawing
.
Point
(
34
,
201
);
this
.
btn_rhombus
.
Location
=
new
System
.
Drawing
.
Point
(
34
,
312
);
this
.
btn_rhombus
.
Name
=
"btn_rhombus"
;
this
.
btn_rhombus
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
31
);
this
.
btn_rhombus
.
TabIndex
=
2
;
...
...
@@ -69,7 +70,7 @@ namespace flowchart
//
// btn_linkline
//
this
.
btn_linkline
.
Location
=
new
System
.
Drawing
.
Point
(
34
,
256
);
this
.
btn_linkline
.
Location
=
new
System
.
Drawing
.
Point
(
34
,
363
);
this
.
btn_linkline
.
Name
=
"btn_linkline"
;
this
.
btn_linkline
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
31
);
this
.
btn_linkline
.
TabIndex
=
3
;
...
...
@@ -82,24 +83,36 @@ namespace flowchart
this
.
CustomPanel
.
BackColor
=
System
.
Drawing
.
SystemColors
.
ActiveBorder
;
this
.
CustomPanel
.
Location
=
new
System
.
Drawing
.
Point
(
174
,
10
);
this
.
CustomPanel
.
Name
=
"CustomPanel"
;
this
.
CustomPanel
.
SelectState
=
flowchart
.
State
.
NONE
;
this
.
CustomPanel
.
Size
=
new
System
.
Drawing
.
Size
(
707
,
533
);
this
.
CustomPanel
.
TabIndex
=
0
;
//
// btn_parallelogram
//
this
.
btn_parallelogram
.
Location
=
new
System
.
Drawing
.
Point
(
34
,
105
);
this
.
btn_parallelogram
.
Location
=
new
System
.
Drawing
.
Point
(
34
,
201
);
this
.
btn_parallelogram
.
Name
=
"btn_parallelogram"
;
this
.
btn_parallelogram
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
31
);
this
.
btn_parallelogram
.
TabIndex
=
4
;
this
.
btn_parallelogram
.
Text
=
"
input
"
;
this
.
btn_parallelogram
.
Text
=
"
read
"
;
this
.
btn_parallelogram
.
UseVisualStyleBackColor
=
true
;
this
.
btn_parallelogram
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_parallelogram_Click
);
//
// btn_ellipse
//
this
.
btn_ellipse
.
Location
=
new
System
.
Drawing
.
Point
(
34
,
145
);
this
.
btn_ellipse
.
Name
=
"btn_ellipse"
;
this
.
btn_ellipse
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
31
);
this
.
btn_ellipse
.
TabIndex
=
5
;
this
.
btn_ellipse
.
Text
=
"start"
;
this
.
btn_ellipse
.
UseVisualStyleBackColor
=
true
;
this
.
btn_ellipse
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_ellipse_Click
);
//
// MainForm
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
886
,
547
);
this
.
Controls
.
Add
(
this
.
btn_ellipse
);
this
.
Controls
.
Add
(
this
.
btn_parallelogram
);
this
.
Controls
.
Add
(
this
.
btn_linkline
);
this
.
Controls
.
Add
(
this
.
btn_rhombus
);
...
...
@@ -120,6 +133,7 @@ namespace flowchart
private
System
.
Windows
.
Forms
.
Button
btn_rhombus
;
private
System
.
Windows
.
Forms
.
Button
btn_linkline
;
private
System
.
Windows
.
Forms
.
Button
btn_parallelogram
;
private
System
.
Windows
.
Forms
.
Button
btn_ellipse
;
}
}
...
...
MainForm.cs
View file @
6c56bdb
...
...
@@ -40,9 +40,15 @@ namespace flowchart
CustomPanel
.
SelectState
=
State
.
PARALLELOGRAM
;
// 평행사변형을 선택
CustomPanel
.
Cursor
=
Cursors
.
Hand
;
// 마우스 모양은 손모양
}
private
void
btn_ellipse_Click
(
object
sender
,
EventArgs
e
)
{
CustomPanel
.
SelectState
=
State
.
ELLIPSE
;
}
private
void
btn_linkline_Click
(
object
sender
,
EventArgs
e
)
{
CustomPanel
.
SelectState
=
State
.
LINKLINE
;
// 링크 라인을 선택
}
}
}
...
...
flowchart.csproj
View file @
6c56bdb
...
...
@@ -54,6 +54,7 @@
<Compile Include="FigParallelogram.cs" />
<Compile Include="FigRectangle.cs" />
<Compile Include="FigRhombus.cs" />
<Compile Include="FigEllipse.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
...
...
flowchart.exe
0 → 100644
View file @
6c56bdb
No preview for this file type
Please
register
or
login
to post a comment