protected override void OnStylusPointsReplaced(StylusPointsReplacedEventArgs e) { if (!initialStrokeCreation) { IEnumerable <StylusPoint> spe = e.PreviousStylusPoints.Where(p => e.NewStylusPoints.FirstOrDefault(sp => sp.X == p.X && sp.Y == p.Y) == null); if (spe.ToList().Count > 0) { StylusPointCollection removedPoints = new StylusPointCollection(spe); for (int i = 0; i < removedPoints.Count; i++) { //connectingPoints.RemoveAll(cp => removedPoints.FirstOrDefault(sp => sp.X == cp.X && sp.Y == cp.Y) != null); List <ConnectingPoint> toRemove = connectingPoints.Where(cp => removedPoints.FirstOrDefault(sp => sp.X == cp.X && sp.Y == cp.Y) != null).ToList(); foreach (ConnectingPoint cp in toRemove) { cp.next.previous = null; } connectingPoints.RemoveAll(cp => removedPoints.FirstOrDefault(sp => sp.X == cp.X && sp.Y == cp.Y) != null); } } } base.OnStylusPointsReplaced(e); }
//</Snippet28> //<Snippet29> void myNewStroke_StylusPointsReplaced(object sender, StylusPointsReplacedEventArgs e) { MessageBox.Show("stylus points replaced"); }
/// <summary>Event handler for stroke data changed events</summary> private void OnStylusPointsReplaced(object sender, StylusPointsReplacedEventArgs args) { Invalidate(); }