-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquare.cs
More file actions
46 lines (40 loc) · 1.17 KB
/
Copy pathSquare.cs
File metadata and controls
46 lines (40 loc) · 1.17 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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProgrammingLanguageIDE
{
public class Square:Shape
{
private int size;
public Square() : base()
{
}
public Square(Color colour, int x, int y, int size) : base(colour, x, y)
{
this.size = size;
}
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.size = list[2];
}
//no draw method here because it is provided by the parent class Rectangle
public override void draw(Graphics g, bool fill, Color color)
{
if (fill)
{
SolidBrush brush = new SolidBrush(color);
g.FillRectangle(brush, x, y, size, size);
}
else
{
Pen pen = new Pen(color, 2);
g.DrawRectangle(pen, x, y, size, size);
}
}
}
}