Exemplo n.º 1
0
        private void picture_MouseDown(object sender, MouseEventArgs e)
        {
            _isDrawing = true;

            switch (figure)
            {
            case "pencil":
                _currentFigure = new Figures.Pencil(e.X, e.Y, bt_Color.BackColor, width);
                picture.Invalidate();
                break;

            case "eraser":
                picture.Cursor = eraser;
                _currentFigure = new Figures.Eraser(e.X, e.Y, Color.White, 30);
                picture.Invalidate();
                break;

            case "square":
                _currentFigure = new Figures.Rectangle(e.X, e.Y, bt_Color.BackColor, width);
                break;

            case "circle":
                _currentFigure = new Figures.Circle(e.X, e.Y, bt_Color.BackColor, width);
                break;

            case "line":
                _currentFigure = new Figures.Line(e.X, e.Y, bt_Color.BackColor, width);
                break;

            case "line2":
                _currentFigure = new Figures.Line2(e.X, e.Y, bt_Color.BackColor, width);
                break;

            case "arrow":
                _currentFigure = new Figures.Arrow(e.X, e.Y, bt_Color.BackColor, width);
                break;

            case "arrow2":
                _currentFigure = new Figures.Arrow2(e.X, e.Y, bt_Color.BackColor, width);
                break;
            }
        }
Exemplo n.º 2
0
        private void picture_MouseDown(object sender, MouseEventArgs e)
        {
            _isDrawing = true;

            switch (figure)
            {
                case "pencil":
                    _currentFigure = new Figures.Pencil(e.X, e.Y, bt_Color.BackColor, width);
                    picture.Invalidate();
                    break;
                case "eraser":
                    picture.Cursor = eraser;
                    _currentFigure = new Figures.Eraser(e.X, e.Y, Color.White, 30);
                    picture.Invalidate();
                    break;
                case "square":
                    _currentFigure = new Figures.Rectangle(e.X, e.Y, bt_Color.BackColor, width);
                    break;
                case "circle":
                    _currentFigure = new Figures.Circle(e.X, e.Y, bt_Color.BackColor, width);
                    break;
                case "line":
                    _currentFigure = new Figures.Line(e.X, e.Y, bt_Color.BackColor, width);
                    break;
                case "line2":
                    _currentFigure = new Figures.Line2(e.X, e.Y, bt_Color.BackColor, width);
                    break;
                case "arrow":
                    _currentFigure = new Figures.Arrow(e.X, e.Y, bt_Color.BackColor, width);
                    break;
                case "arrow2":
                    _currentFigure = new Figures.Arrow2(e.X, e.Y, bt_Color.BackColor, width);
                    break;
            }
        }