I think we need a interface for every drawing tools in program. Before all, we need enum contains tools. Then, generate new instance implemented from this interface.
public enum Drawing_Tool
{
Pen,
Eraser,
Text,
Filler,
Color_Picker,
Zoom
}
public interface ITool
{
public void Draw();
}
Related classes implemented from interface
public class Pen : ITool
{
public void Draw() => throw new NotImplementedException();
}
public class Zoom : ITool
{
public void Draw() => throw new NotImplementedException();
}
public class Eraser : ITool
{
public void Draw() => throw new NotImplementedException();
}
public class Color_Picker : ITool
{
public void Draw() => throw new NotImplementedException();
}
public class Filler : ITool
{
public void Draw() => throw new NotImplementedException();
}
A function which generate instance then return tool
public ITool GetTool(Drawing_Tool tool)
{
ITool currentTool = null;
switch (tool)
{
case Drawing_Tool.Pen:
currentTool = new Pen();
break;
case Drawing_Tool.Eraser:
currentTool = new Eraser();
break;
case Drawing_Tool.Filler:
currentTool = new Filler();
break;
case Drawing_Tool.Text:
currentTool = new Text();
break;
case Drawing_Tool.Color_Picker:
currentTool = new Color_Picker();
break;
case Drawing_Tool.Zoom:
currentTool = new Zoom();
break;
}
return currentTool;
}