private void pictureBox_MouseDown(object sender, MouseEventArgs e) { if (PaintMode) { if (figure is TriangleFigure) { if (figure.Points.Count % 3 == 0) { figure = figureFactory.CreateFigure(figure.FigureController); } } if (!(figure is CurveFigure || figure is IrregularPolygonFigure || figure is TriangleFigure)) { figure = figureFactory.CreateFigure(figure.FigureController); } if (figure is PolygonFigure) { PolygonFigure tmp = (PolygonFigure)figure; tmp.N = (int)numericUpDown.Value; figure = tmp; } pictureBox.Image = canvas.TmpBitmap; figure.FigureController.MouseDownHandle(e.Location, pen, figure, canvas); pictureBox.Image = canvas.MainBitmap; } if (PaintMode == false) { toolController.MouseDownHandle(e.Location, pen, figure, canvas, container, tool); pictureBox.Image = canvas.MainBitmap; } }
FillCellResult IBoardInternal.FillCell(FigureType figureType, int row, int column) { if (!TryGetCell(row, column, out var cell)) { return(FillCellResult.CellNotFound); } if (!cell.IsEmpty) { return(FillCellResult.CellOccupied); } cell.Figure = _figureFactory.CreateFigure(figureType); return(FillCellResult.Successful); }
private void RightTriangle_Click(object sender, EventArgs e) { textBox1.Visible = false; numericUpDown.Visible = false; Button Btn = sender as Button; if (Btn != null) { setColor(this, Btn); } figureFactory = new RightTriangleFactory(); figure = figureFactory.CreateFigure(figure.FigureController); PaintMode = true; }