public void DrowOnlyOneFigure(CreatedFigure cf) { drawer = abstractFabric.CreateDrower(cf.figur, cf.brush, cf.fill); drawer.Draw(cf); Graphics graph = Graphics.FromImage(bitmap); graph.DrawImage(bitFigure, 0, 0); }
public void DrowNotAllFigure(CreatedFigure cf2) { foreach (CreatedFigure f in listOfFigure) { if (f != cf2) { drawer = abstractFabric.CreateDrower(f.figur, f.brush, f.fill); drawer.Draw(f); } Graphics graph = Graphics.FromImage(bitmap); graph.DrawImage(bitFigure, 0, 0); } }
public void DrowAllFigure() { foreach (CreatedFigure f in listOfFigure) { Point tmp = f.poin[0]; foreach (Point p in f.poin) { drawer.Draw(f); tmp = p; } Graphics graph = Graphics.FromImage(bitmap); graph.DrawImage(bitFigure, 0, 0); } }
private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (e.X < 0 || e.X > pictureBox1.Width || e.Y < 0 || e.Y > pictureBox1.Height) { isFirst = true; } if (isDrow == true && e.X > 0 && e.X < pictureBox1.Width && e.Y > 0 && e.Y < pictureBox1.Height) { if (drowing == true) { brush.SetIsFirst(isFirst); isFirst = false; if (!(abstractFabric is UncommonPoligon)) { q.bitFigure = new Bitmap(pictureBox1.Width, pictureBox1.Height); if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { if (Figure is Ellipse) { cf.figur = new Сircle(); drower = abstractFabric.CreateDrower(cf.figur, cf.brush, cf.fill); isFigureChanged = true; } else if (Figure is Rectangl) { cf.figur = new Square(); drower = abstractFabric.CreateDrower(cf.figur, cf.brush, cf.fill); isFigureChanged = true; } else if (Figure is IsoscelesTriangle) { cf.figur = new RightTriangle(); drower = abstractFabric.CreateDrower(cf.figur, cf.brush, cf.fill); isFigureChanged = true; } } else if ((Control.ModifierKeys & Keys.Shift) != Keys.Shift) { if (Figure is Ellipse && isFigureChanged == true) { cf.figur = new Ellipse(); drower = abstractFabric.CreateDrower(cf.figur, cf.brush, cf.fill); isFigureChanged = false; } else if (Figure is Rectangl && isFigureChanged == true) { cf.figur = new Rectangl(); drower = abstractFabric.CreateDrower(cf.figur, cf.brush, cf.fill); isFigureChanged = false; } else if (Figure is IsoscelesTriangle && isFigureChanged == true) { cf.figur = new IsoscelesTriangle(); drower = abstractFabric.CreateDrower(cf.figur, cf.brush, cf.fill); isFigureChanged = false; } } last = e.Location; drower.Draw(first, last, nAngle, cf); if (!(drower is ClassLine)) { q.DrawFigure(); } else if (drower is ClassLine) { q.DrawLine(); first = last; } pictureBox1.Image = q.bitmap; } } else if ((isHanded == true || isGran == true) && currentFigur != null) { q.bitFigure = new Bitmap(pictureBox1.Width, pictureBox1.Height); moving.ChangeFigure(e.Location); q.Move(); q.DrowOnlyOneFigure(currentFigur); pictureBox1.Image = q.bitmap; } else if (isZoom == true && currentFigur != null) { q.bitFigure = new Bitmap(pictureBox1.Width, pictureBox1.Height); if (currentFigur.figur is Сircle) { drower.Draw(currentFigur.centr, e.Location, nAngle, currentFigur); } else if (currentFigur.figur is Ellipse) { Point po = new Point(currentFigur.l.X + (e.X - first.X), currentFigur.l.Y + (e.Y - first.Y)); drower.Draw(currentFigur.f, po, nAngle, currentFigur); first = e.Location; } else { moving.ChangeFigure(e.Location); } q.DrawFigure(); q.DrowOnlyOneFigure(currentFigur); pictureBox1.Image = q.bitmap; q.bitFigure = new Bitmap(pictureBox1.Width, pictureBox1.Height); } else if (isTurn == true && currentFigur != null) { q.bitFigure = new Bitmap(pictureBox1.Width, pictureBox1.Height); moving.ChangeFigure(e.Location); q.Move(); q.DrowOnlyOneFigure(currentFigur); pictureBox1.Image = q.bitmap; } else if (isTop == true && currentFigur != null) { q.bitFigure = new Bitmap(pictureBox1.Width, pictureBox1.Height); currentFigur.poin[tmpIndex] = e.Location; q.DrowOnlyOneFigure(currentFigur); q.DrawFigure(); pictureBox1.Image = q.bitmap; } else if (isFigureChanged == true && currentFigur != null) { q.bitFigure = new Bitmap(pictureBox1.Width, pictureBox1.Height); currentFigur.poin[tmpIndex] = e.Location; drower.Draw(first, currentFigur.poin[tmpIndex], nAngle, cf); q.DrowOnlyOneFigure(currentFigur); q.DrawFigure(); pictureBox1.Image = q.bitmap; } } }