-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle.cs
More file actions
48 lines (41 loc) · 1.23 KB
/
Copy pathRectangle.cs
File metadata and controls
48 lines (41 loc) · 1.23 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
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProgrammingLanguageIDE
{
public class Rectangle:Shape
{
int width, height;
public Rectangle() : base()
{
}
public Rectangle(Color colour, int x, int y, int width, int height) : base(colour, x, y)
{
this.width = width; //the only thing that is different from shape
this.height = height;
}
public override void set(params int[] list)
{
//list[0] is x, list[1] is y, list[2] is width, list[3] is height
base.set(list[0], list[1]);
this.width = list[2];
this.height = list[3];
}
public override void draw(Graphics g, bool fill, Color color)
{
if (fill)
{
SolidBrush b = new SolidBrush(color);
g.FillRectangle(b, x, y, width, height);
}
else
{
Pen p = new Pen(color, 2);
g.DrawRectangle(p, x, y, width, height);
}
}
}
}