Showing
1 changed file
with
44 additions
and
0 deletions
FigRhombus.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 FigRhombus : FigBase | ||
13 | + { | ||
14 | + // 생성자도 상속해서 사용. | ||
15 | + public FigRhombus(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 | + // 마름모 그리는 함수 | ||
26 | + int x1, x2, x3, y1, y2, y3; | ||
27 | + x1 = Location.X; | ||
28 | + x2 = x1 + Size.Width / 2; | ||
29 | + x3 = x1+Size.Width; | ||
30 | + y1 = Location.Y; | ||
31 | + y2 = y1 - Size.Height / 2; | ||
32 | + y3 = y1 - Size.Height; | ||
33 | + | ||
34 | + g.DrawLine(pen, x1, y2, x2, y1); | ||
35 | + g.DrawLine(pen, x2, y1, x3, y2); | ||
36 | + g.DrawLine(pen, x3, y2, x2, y3); | ||
37 | + g.DrawLine(pen, x2, y3, x1, y2); | ||
38 | + | ||
39 | + } | ||
40 | + | ||
41 | + base.Draw(g); | ||
42 | + } | ||
43 | + } | ||
44 | +} |
-
Please register or login to post a comment