남윤형

평행사변형을 만드는 클래스 생성

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 + class FigParallelogram : FigBase
11 + {
12 + // 생성자도 상속해서 사용.
13 + public FigParallelogram(Point location, Size size) : base(location, size)
14 + {
15 +
16 + }
17 +
18 + public override void Draw(Graphics g)
19 + {
20 + //평행사변형을 그리는 함수
21 + using (Pen pen = new Pen(Color.Red, 1))
22 + {
23 + int x1, x2, x3, x4, y1, y2;
24 + x1 = Location.X + 30;
25 + x2 = Location.X + Size.Width;
26 + x3 = Location.X ;
27 + x4 = Location.X + 70;
28 + y1 = Location.Y;
29 + y2 = Location.Y + Size.Height;
30 +
31 +
32 + g.DrawLine(pen, x1, y1, x3, y2);
33 + g.DrawLine(pen, x3, y2, x4, y2);
34 + g.DrawLine(pen, x4, y2, x2, y1);
35 + g.DrawLine(pen, x2, y1, x1, y1);
36 + }
37 +
38 + base.Draw(g);
39 + }
40 + }
41 +}