private void OnColorPick_cp(object sender, RoutedPropertyChangedEventArgs <System.Windows.Media.Color?> e) { if (!(bool)changeColor_btn.IsChecked) { MyStrokeCollection strokeCollection = new MyStrokeCollection(InkCanvas.GetSelectedStrokes()); colorHandler.onColorPick(InkCanvas, colorPicker, canvasObjectHandler.getPolygonShape().getPolygon()); canvasObjectHandler.getPolygonShape().replaceSelectedStroke(InkCanvas); } }
public void replaceSelectedStroke(InkCanvas _InkCanvas) { MyStrokeCollection strokeCollection = new MyStrokeCollection(_InkCanvas.GetSelectedStrokes()); printPolygon(strokeCollection, _InkCanvas); foreach (Stroke aStroke in strokeCollection) { _InkCanvas.Strokes.Remove(aStroke); } }
public void printPolygon(MyStrokeCollection _strokeCollection, InkCanvas _InkCanvas) { MyStrokeCollection strokeCollections = new MyStrokeCollection(_strokeCollection); for (int i = 0; i < strokeCollections.Count; i++) { for (int j = 0; j < strokeCollections[i].StylusPoints.Count; j++) { polygon.Points.Add(strokeCollections[i].StylusPoints[j].ToPoint()); } } _InkCanvas.Children.Add(polygon); }