/// <summary> /// Определение параметров рисуемой фигуры /// </summary> /// <param name="brush">Кисть для заливки</param> /// <param name="pen">Перо для контура</param> private Params GetParams(SolidBrush brush, Pen pen) { var @params = new Params { Path = new GraphicsPath(), Pen = pen.CloneTool(), Brush = brush.CloneTool(), }; switch (Tool) { case ToolKind.Ellipse: @params.Path.AddEllipse(_startPoint.GetRectangle(_endPoint, IsEqual)); break; case ToolKind.Rectangle: @params.Path.AddRectangle(_startPoint.GetRectangle(_endPoint, IsEqual)); break; case ToolKind.Line: @params.Path.AddLine(_startPoint, _endPoint); @params.Brush.Dispose(); break; case ToolKind.Eraser: @params.Brush = _eraseTool.EraseColor.Brush().CloneTool(); @params.Pen.Dispose(); @params.EraseRegion = _eraseTool.EraseRegion; break; case ToolKind.None: @params.Dispose(); @params = null; break; } return(@params); }