FigRhombus.cs
1.21 KB
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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace flowchart
{
class FigRhombus : FigBase
{
// 프로세스 마름모를 그리는 클래스(FigureBase를 상속)
// Draw 함수에서 마름모를 그린다.
// 생성자도 상속해서 사용.
public FigRhombus(Point location, Size size) : base(location, size)
{
}
public override void Draw(Graphics g)
{
using (Pen pen = new Pen(Color.Red, 1))
{
//Rectangle rect = new Rectangle(this.Location, this.Size);
int x1, x2, x3, y1, y2, y3;
x1 = Location.X;
x2 = Location.X + Size.Width / 2;
x3 = Location.X + Size.Width;
y1 = Location.Y;
y2 = Location.Y + Size.Height / 2;
y3 = Location.Y + Size.Height;
g.DrawLine(pen, x1, y2, x2, y1);
g.DrawLine(pen, x2, y1, x3, y2);
g.DrawLine(pen, x3, y2, x2, y3);
g.DrawLine(pen, x2, y3, x1, y2);
}
base.Draw(g);
}
}
}