public IShape Clone() { RedRectangle redRectangle = new RedRectangle(); redRectangle.Point1 = Point1; redRectangle.Point2 = Point2; return redRectangle; }
private void PnlDrawingArea_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && UserShapeCreator != null) { UserShape userShape = UserShapeCreator.GetUserShape(); userShape.CopyToListShapes(TempShapes, FirstPoint, new Point(e.X, e.Y)); foreach (IShape shape in TempShapes) { Shapes.Add(shape); } DoDrawing(Shapes); foreach (IShape shape in TempShapes) { Shapes.Remove(shape); } TempShapes.Clear(); } if (e.Button == MouseButtons.Left && IsSelecting) { RedRectangle redRectangle = new RedRectangle(); redRectangle.Point1 = FirstPoint; redRectangle.Point2 = new Point(e.X, e.Y); Shapes.Add(redRectangle); DoDrawing(Shapes); Shapes.Remove(redRectangle); } if (e.Button == MouseButtons.Left && ShapeCreator != null) { TempShape = ShapeCreator.GetShape(); TempShape.Point1 = FirstPoint; TempShape.Point2 = new Point(e.X, e.Y); Shapes.Add(TempShape); DoDrawing(Shapes); Shapes.Remove(TempShape); } }