Added Methods for Drawer class

This commit is contained in:
Lukasz Baldyga committed 2020-10-08 17:44:05 +01:00
1 parent f423716054
commit 8ae2f566fc
1 file changed
+17 -1
@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -66,12 +67,27 @@ namespace Advanced_Software_Engineering
Pen pen = new Pen(defaultPenColor, defaultPenWidth); Pen pen = new Pen(defaultPenColor, defaultPenWidth);
bool penDown = true; bool penDown = true;
Point penPosition; Point penPosition;
Graphics graphics;
public Drawer(Graphics graphics) public Drawer(Graphics graphics)
{ {
this.graphics = graphics;
} }
public void MovePen(Point point)
{
if(penDown) graphics.DrawLine(pen, penPosition, point);
this.penPosition = point;
}
public bool isPenDown() => penDown;
public void PenUp() => penDown = false;
public void PenDown() => penDown = true;
} }
} }