public void MouseMove(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e) { figure.Create(x1, y1, x2, y2); figureTmp.Create(x1, y1, x2, y2); if (cursorActive == true) { canvas.LoadFromCache(); x2 = e.X; y2 = e.Y; IFill tmpFill = new NoFill(); IBrush tmpBrush; if (fill is OnlyFill) { tmpBrush = new SquareBrush(1, fill.FillColor); } else { tmpBrush = brush; } Drawfigure drawer = new Drawfigure(figure, tmpBrush, tmpFill); Drawfigure drawerTmp = new Drawfigure(figureTmp, tmpBrush, tmpFill); drawer.Draw(canvas); canvas.WriteToPictureBox(sheet); } }
public void MouseMove(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e) { if (cursorActive) { canvas.LoadFromCache(); canvas.Turn(activeFigure); activeFigure.Draw(canvas); canvas.WriteToPictureBox(sheet); } }
public void MouseDown(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e) { cursorActive = true; for (int i = -10; i <= 10; i++) { for (int j = -10; j <= 10; j++) { Point p = new Point(e.X + i, e.Y + j); activeFigure = canvas.FindFigureByPoint(p); if (activeFigure != null) { tmpIndex = canvas.FindPointByPoint(p); break; } } if (activeFigure != null) { break; } } //для дабл клика(добавления вершин) if (activeFigure == null) { cursorActive = false; foreach (Drawfigure f in canvas.figures) { if (f.figure.IsInside(e.Location)) { activeFigure = f; } } } //--------- if (activeFigure != null) { canvas.RenderExceptFigure(activeFigure); canvas.SaveToCache(); activeFigure.Draw(canvas); canvas.WriteToPictureBox(sheet); } }
public void MouseMove(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e) { if (cursorActive) { canvas.LoadFromCache(); dx = e.X - tmpPoint.X; dy = e.Y - tmpPoint.Y; activeFigure.figure.MoveFigure(dx, dy); tmpPoint = e.Location; activeFigure.Draw(canvas); canvas.WriteToPictureBox(sheet); } }
public void MouseUp(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e) { cursorActive = false; x2 = e.X; y2 = e.Y; Drawfigure drawer = new Drawfigure(figure, brush, fill); Drawfigure drawerTmp = new Drawfigure(figureTmp, brush, fill); if (canvas is VectorCanvas) { VectorCanvas.GetCanvas.figures.Add(drawer); VectorCanvas.GetCanvas.figuresTmp.Add(drawerTmp); } drawer.Draw(canvas); canvas.WriteToPictureBox(sheet); }
public void MouseMove(PictureBox sheet, IBrush brush, IFill fill, MouseEventArgs e) { if (cursorActive) { if (activeFigure != null) { canvas.LoadFromCache(); dx = e.X - tmpPoint.X; dy = e.Y - tmpPoint.Y; activeFigure.figure.ChangeSizeFigure(dx, dy, activecorner); tmpPoint = e.Location; activeFigure.Draw(canvas); canvas.PointChangeModeOfRectangle(sheet, activeFigure); canvas.WriteToPictureBox(sheet); } } }