public object Clone() { List <Point> points = new List <Point>(); foreach (Point p in this.points) { points.Add(p); } MyPen clone = new MyPen(points); clone.Pen = this.Pen; return(clone); }
private void AddShapeToList(Point endPoint) { //Обрабатываются в клике if (this.typeTool == SHAPES.FILLTOOL || this.typeTool == SHAPES.COLORCHOICE) { return; } Shape currentShape = null; switch (this.typeTool) { case SHAPES.PEN: this.pointsOfMovement.Add(endPoint); MyPen myPen = new MyPen(this.pointsOfMovement); Pen pen = new Pen(this.colorChoicer.FColor, this.widthChiocer.LineWidth); myPen.Pen = pen; this.shapesList.Add(myPen); this.pointsOfMovement.Clear(); this.UpdateShapeListComboBox(); return; case SHAPES.LINE: currentShape = new MyLine(this.bPoint, endPoint); break; case SHAPES.RECTANGLE: currentShape = new MyRectangle(this.bPoint, endPoint); break; case SHAPES.FILLRECTANGLE: currentShape = new MyRectangle(this.bPoint, endPoint, true); break; case SHAPES.ELLIPS: currentShape = new MyEllipse(this.bPoint, endPoint); break; case SHAPES.FILLELLIPS: currentShape = new MyEllipse(this.bPoint, endPoint, true); break; default: throw new ShapeException("Неизвестный тип фигуры"); } Pen currentPen = new Pen(this.colorChoicer.FColor, this.widthChiocer.LineWidth); currentPen.DashStyle = this.lineStyleChoicer.SelectedStyle; currentShape.Pen = currentPen; if (this.hatchChoiser.SelectedHatch == null) { currentShape.Brush = new SolidBrush(this.colorChoicer.BColor); } else { currentShape.Brush = new HatchBrush((HatchStyle)this.hatchChoiser.SelectedHatch, this.colorChoicer.FColor, this.colorChoicer.BColor); } this.shapesList.Add(currentShape); this.UpdateShapeListComboBox(); this.pointsOfMovement.Clear(); }
public object Clone() { List<Point> points = new List<Point>(); foreach (Point p in this.points) { points.Add(p); } MyPen clone = new MyPen(points); clone.Pen = this.Pen; return clone; }