public void MouseDown(Pen p, MouseEventArgs e, AFigure figure, IFigureFabric fabric) { _singletone = SingletonData.GetData(); _movingFigure = null; foreach (AFigure checkFigure in _singletone.FigureList) { //if (checkFigure.IsPeak(e.Location)) //{ // _figure = checkFigure; // movingFigure = checkFigure; // figuresList.Remove(_figure); // pictureBox1.Image = canvas.Clear(); // DrawAll(); // startPoint = checkFigure.touchPoint; // mode = "PEAK"; // break; //} if (checkFigure.IsEdge(e.Location) || (checkFigure.IsArea(e.Location) && checkFigure.IsFilled)) { _movingFigure = checkFigure; _singletone.FigureList.Remove(checkFigure); _singletone.PictureBox1.Image = _singletone.Canvas.Clear(); foreach (AFigure figureINList in _singletone.FigureList) { _singletone.PictureBox1.Image = _singletone.Canvas.DrawIt(figureINList, new Pen(figureINList.Color, figureINList.Width)); _singletone.Canvas.Save(); } _startPoint = checkFigure.TouchPoint; break; } } }
public void MouseDown(Pen p, MouseEventArgs e, AFigure figure, IFigureFabric fabric) { _singletone = SingletonData.GetData(); if (fabric is LineNDIFabric || fabric is FigureNDIFabric || fabric is Triangle3DIFabric) { //если фигура начинается то записать первую стартПоинт if (_figure == null) { _figure = fabric.CreateFigure(p); _startPoint = e.Location; _figure.TmpPoint = e.Location; _figure.Started = true; } else { _figure.TmpPoint = e.Location; _startPoint = _figure.SecondPoint; } } else { _startPoint = e.Location; _figure = fabric.CreateFigure(p); } }
private void Form1_Load(object sender, EventArgs e) { _data = SingletonData.GetData(); _data.PictureBox1 = pictureBox1; _data.Canvas = new Canvas(pictureBox1.Width, pictureBox1.Height); fabric = new BrushFabric(); _figure = fabric.CreateFigure(_pen); _mouseMode = new PaintIMode(); }
public void Do() { if (_figure.AnglesNumber == 3) { _figure.PointsList.Add(new PointF(_figure.PointsList[0].X, _figure.PointsList[0].Y)); _singletone = SingletonData.GetData(); _singletone.PictureBox1.Image = _singletone.Canvas.DrawIt(_figure, new Pen(_figure.Color, _figure.Width)); } }
public void MouseDown(Pen p, MouseEventArgs e, AFigure figure, IFigureFabric fabric) { _singletone = SingletonData.GetData(); _rotateFigure = null; foreach (AFigure checkFigure in _singletone.FigureList) { if (checkFigure.IsEdge(e.Location) || (checkFigure.IsArea(e.Location) && checkFigure.IsFilled)) { _rotateFigure = checkFigure; _singletone.FigureList.Remove(checkFigure); _singletone.PictureBox1.Image = _singletone.Canvas.Clear(); foreach (AFigure figureINList in _singletone.FigureList) { _singletone.PictureBox1.Image = _singletone.Canvas.DrawIt(figureINList, new Pen(figureINList.Color, figureINList.Width)); _singletone.Canvas.Save(); } _startPoint = checkFigure.TouchPoint; break; } } }
public void MouseDown(Pen p, MouseEventArgs e, AFigure figure, IFigureFabric fabric) { _singletone = SingletonData.GetData(); foreach (AFigure checkFigure in _singletone.FigureList) { if (checkFigure.IsEdge(e.Location)) { _figure = checkFigure; _movingFigure = checkFigure; _singletone.FigureList.Remove(_figure);//это удаление первой по значению? _figure.AddPeak(); fabric = new FigureNDIFabric(); _figure = fabric.CreateFigure(p); _singletone.PictureBox1.Image = _singletone.Canvas.Clear(); foreach (AFigure figureINList in _singletone.FigureList) { _singletone.PictureBox1.Image = _singletone.Canvas.DrawIt(figureINList, new Pen(figureINList.Color, figureINList.Width)); _singletone.Canvas.Save(); } _startPoint = checkFigure.TouchPoint; } } }
public void MouseUp(Pen pen, MouseEventArgs e, IFigureFabric fabric) { _mouseMove = false; if (_figure != null && _figure.Reaction is NoReactionIReaction) { _figure.Reaction.Do(); SingletonData _fL = SingletonData.GetData(); _fL.FigureList.Add(_figure); _figure = null; } else if (_figure != null && _figure.Reaction is Triangle3DIRightClickReaction && _figure.AnglesNumber == 3) { //ничего не происходит для фигур с FreeLineIRightClickReaction и FreeFigureIRightClickReaction _figure.Reaction.Do(); SingletonData _fL = SingletonData.GetData(); _fL.FigureList.Add(_figure); _figure = null; } if (e.Button == MouseButtons.Right && _figure != null) { if (_figure.Reaction is FreeLineIRightClickReaction || _figure.Reaction is FreeFigureIRightClickReaction) { _figure.Reaction.Do(); SingletonData _fL = SingletonData.GetData(); _fL.FigureList.Add(_figure); _figure = null; } else { _figure.Reaction.Do(); } } }