public void duplicateLine(MouseEventArgs _obj, InkCanvas _InkCanvas) { Polyline tempLine = (Polyline)_obj.OriginalSource; MyDrawingAttributes drawingAttribute = new MyDrawingAttributes() { Color = Colors.Black }; MyStylusPointCollection points = new MyStylusPointCollection(); foreach (Point aPoint in tempLine.Points) { points.Add(new StylusPoint(aPoint.X, aPoint.Y)); } MyStroke newStroke = new MyStroke(points, drawingAttribute); _InkCanvas.Strokes.Add(newStroke); tempLine = new Polyline(); tempLine.Stroke = Brushes.Black; foreach (StylusPoint aStylusPoint in newStroke.StylusPoints) { tempLine.Points.Add(aStylusPoint.ToPoint()); } _InkCanvas.Strokes.Remove(newStroke); _InkCanvas.Children.Add(tempLine); }
public void duplicatePolygon(MouseEventArgs _obj, InkCanvas _InkCanvas) { Polygon originalPolygon = (Polygon)_obj.OriginalSource; MyDrawingAttributes drawingAttribute = new MyDrawingAttributes() { Color = Colors.Black }; MyStylusPointCollection points = new MyStylusPointCollection(); foreach (Point aPoint in originalPolygon.Points) { points.Add(new StylusPoint(aPoint.X, aPoint.Y)); } MyStroke newStroke = new MyStroke(points, drawingAttribute); _InkCanvas.Strokes.Add(newStroke); Polygon tempPolygon = originalPolygon; originalPolygon = new Polygon() { Stroke = Brushes.Black }; foreach (StylusPoint aStylusPoint in newStroke.StylusPoints) { originalPolygon.Points.Add(aStylusPoint.ToPoint()); } BrushConverter brushConverter = new BrushConverter(); Brush brush = (Brush)brushConverter.ConvertFromString(tempPolygon.Fill.ToString()); originalPolygon.Fill = brush; _InkCanvas.Strokes.Remove(newStroke); _InkCanvas.Children.Add(originalPolygon); }
public MyStroke(MyStylusPointCollection stylusPoints, MyDrawingAttributes drawingAttributes) : base(stylusPoints, drawingAttributes) { }