public void DrawExceptIndexFigures(AFigure currentFigure) { foreach (AFigure i in _figureList) { if (i != currentFigure) { DrawFigure(i); } } }
private void pictureBox1_MouseClick(object sender, MouseEventArgs e) { _clickFigure = sBitmap.FigureUnderMouse(e.Location); if (_clickFigure != null && _currentFigure._startPoint != new Point(0, 0)) { _currentFigure = _clickFigure; tool.DoLogicOnMouseClick(e.Location, _currentFigure, _fillColor); pictureBox1.Image = sBitmap._tmpBitmap; sBitmap.Update(); } }
public void FillExceptIndexFigures(AFigure currentFigure) { //_fillBitmap = (Bitmap)_tmpBitmap.Clone(); foreach (AFigure i in _figureList) { if (i != currentFigure) { i.FillFigure(i._centerPoint); //CopyFromFill(); } } }
public void vDrawFigure(AFigure figure) { if (figure._linewWidth == 0) { foreach (Point i in figure.GetPoints()) { SetPixel(i.X, i.Y, figure._colorLine); } } else { figure.WidthLine(); } }
//Метод, который принимает настроенную фигуру, //вызывает все ее точки и рисует каждую точку public Bitmap DrawFigure(AFigure figure) { if (figure._linewWidth == 0) { foreach (Point i in figure.GetPoints()) { SetPixel(i.X, i.Y, figure._colorLine); } } else { figure.WidthLine(); } return(_tmpBitmap); }
public AFigure FigureUnderMouse(Point mouse) { AFigure figure = null; foreach (AFigure i in _figureList) { if (i.IsMouseOnFigure(mouse)) { figure = i; if (figure != null) { return(figure); } } } return(figure); }
private void pictureBox_MouseDown(object sender, MouseEventArgs e) { _prevPoint = e.Location; mousePress = true; if (_factory != null) { _factory.Update(); } else { _clickFigure = sBitmap.FigureUnderMouse(e.Location); if (_clickFigure != null) { _currentFigure = _clickFigure; tool.DoLogigOnMouseDown(_currentFigure); } } }
private void pictureBox_MouseMove_1(object sender, MouseEventArgs e) { if (mousePress) { _currentPoint = e.Location; sBitmap.Copy(); if (_factory != null) { _currentFigure = _factory.Create(_prevPoint, _currentPoint, _currentColor, _fillColor, width); sBitmap.DrawFigure(_currentFigure); } else if (_clickFigure != null) { tool.DoLogicOnMouseMove(_prevPoint, _currentPoint, _currentFigure); } pictureBox1.Image = sBitmap._tmpBitmap; } toolStripStatusLabel1.Text = ($"Coordinates = {e.Location}"); }
private void openSourceToolStripMenuItem_Click_1(object sender, EventArgs e) { if (pictureBox1.Image != null) //если в pictureBox есть изображение { //BitmapSingletone.GetInstance().Clear(); //pictureBox1.Image = null; _currentFigure = new Pencil(); _fillColor = Color.Transparent; DialogResult result = dialog.NewDialog(); switch (result) { case DialogResult.Yes: dialog.SaveSourceDialog(); sBitmap.Clear(); sBitmap.Update(); dialog.OpenSourceDialog(); break; case DialogResult.No: sBitmap.Clear(); sBitmap.Update(); dialog.OpenSourceDialog(); break; case DialogResult.Cancel: break; } //pictureBox1.Image = sBitmap._bitmap; } else { pictureBox1.Image = null; _fillColor = Color.Transparent; sBitmap.Clear(); dialog.OpenSourceDialog(); //pictureBox1.Image = sBitmap._bitmap; } pictureBox1.Image = null; }
public List <AFigure> SaveFigures(AFigure figure) { _figureList.Add(figure); return(_figureList); }
public void EraseIndexFigure(AFigure currentFigure) { _figureList.Remove(currentFigure); DrawAllFigures(); }
public void FillFigure(AFigure figure) { figure.FillFigure(figure._centerPoint); }
public virtual AFigure Move(Point start, Point end, AFigure movingFigure) { int X0 = movingFigure._startPoint.X; int Y0 = movingFigure._startPoint.Y; int X1 = movingFigure._endPoint.X; int Y1 = movingFigure._endPoint.Y; if (_movingPoint == new Point(0, 0)) { _movingPoint = start; _nextMovingPoint = end; } else { _movingPoint = _nextMovingPoint; _nextMovingPoint = end; } if (end.X >= start.X && end.Y >= start.Y) { int dx = end.X - _movingPoint.X; int dy = end.Y - _movingPoint.Y; X0 += dx; Y0 += dy; X1 += dx; Y1 += dy; } else if (end.X >= start.X && end.Y <= start.Y) { int dx = end.X - _movingPoint.X; int dy = _movingPoint.Y - end.Y; X0 += dx; Y0 -= dy; X1 += dx; Y1 -= dy; } else if (end.X <= start.X && end.Y >= start.Y) { int dx = _movingPoint.X - end.X; int dy = end.Y - _movingPoint.Y; X0 -= dx; Y0 += dy; X1 -= dx; Y1 += dy; } else if (end.X <= start.X && end.Y <= start.Y) { int dx = _movingPoint.X - end.X; int dy = _movingPoint.Y - end.Y; X0 -= dx; Y0 -= dy; X1 -= dx; Y1 -= dy; } movingFigure._startPoint = new Point(X0, Y0); movingFigure._endPoint = new Point(X1, Y1); return(movingFigure); }