private void searchStrokes(string searchString, string imageName, InkCanvas inkCanvas) { StrokeCollection[] strokes = analyze.Search(searchString); foreach (StrokeCollection sc in strokes) { foreach (Stroke s in sc) { if (inkCanvas.Strokes.IndexOf(s) != -1) { inkCanvas.Strokes.Remove(sc); } if (analyze.RootNode.Strokes.IndexOf(s) != -1) { analyze.RemoveStrokes(sc); } } addImage(imageName, new Thickness(sc[0].StylusPoints[0].X, sc[0].StylusPoints[0].Y, 0, 0), inkCanvas); } }