protected override void OnStrokesReplaced(InkCanvasStrokesReplacedEventArgs e) { //if the stroke doesnt have stylus points if (e.NewStrokes.Count == 0) { return; } //if stroke is loaded from the file change its PreviousColor to gray StrokeCollection sc = new StrokeCollection(); foreach (Stroke s in e.NewStrokes) { s.DrawingAttributes.Color = Colors.Gray; sc.Add(s); } ExpertStrokeLoaded = true; ExpertStrokeLoadedEventEventArgs args = new ExpertStrokeLoadedEventEventArgs(); args.strokes = sc; args.state = ExpertStrokeLoaded; OnExpertStrokeLoaded(args); // start the animation base.OnStrokesReplaced(e); }//OnStrokesReplaced
protected virtual void OnStrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e) { InkCanvasStrokesReplacedEventHandler handler = StrokesReplaced; if (handler != null) { handler(this, e); } }
void inkCanvas1_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e) { if (StrokeCollection.ReferenceEquals(e.NewStrokes, player1)) { Title = "Player one's turn"; } else { Title = "Player two's turn"; } }
/// <summary>当从文件中加载墨迹时,会自动调用此方法</summary> protected override void OnStrokesReplaced(InkCanvasStrokesReplacedEventArgs e) { isFromFileInk = true; StrokeCollection strokes = e.NewStrokes.Clone(); this.Strokes.Remove(e.NewStrokes); base.OnStrokesReplaced(e); foreach (var v in strokes) { this.Strokes.Remove(v); Guid id = v.GetPropertyDataIds()[0]; string[] s = ((string)v.GetPropertyData(id)).Split('#'); MyInkData data = new MyInkData(); for (int i = 0; i < s.Length; i++) { string[] property = s[i].Split(':'); switch (property[0]) { case "inkName": this.SetInkAttributes(property[1]); break; case "inkRadius": data.inkRadius = double.Parse(property[1]); break; case "inkColor": string[] c = property[1].Split(','); data.inkColor = Color.FromArgb(byte.Parse(c[0]), byte.Parse(c[1]), byte.Parse(c[2]), byte.Parse(c[3])); break; case "inkBrushType": data.inkBrushType = (InkBrushType)Enum.Parse(typeof(InkBrushType), property[1]); break; case "inkStylusType": data.inkStylusType = (InkStylusType)Enum.Parse(typeof(InkStylusType), property[1]); break; case "inkDrawOption": data.inkDrawOption = (InkDrawOption)Enum.Parse(typeof(InkDrawOption), property[1]); break; } } ink.inkTool = ink.CreateFromInkData(data); InkCanvasStrokeCollectedEventArgs args = new InkCanvasStrokeCollectedEventArgs(v); this.OnStrokeCollected(args); } }
/// <summary> /// Protected override called when the InkAnalysisCanvas.Strokes StrokeCollection is replaced /// </summary> protected override void OnStrokesReplaced(InkCanvasStrokesReplacedEventArgs e) { //update the InkAnalyzer and unsubscribe / subscribe to StrokeChanged events _inkAnalyzer.RemoveStrokes(e.PreviousStrokes); e.PreviousStrokes.StrokesChanged -= OnStrokesChanged; foreach (Stroke stroke in e.PreviousStrokes) { //we're removing this stroke so we don't need to listen //to StylusPointsChanged anymore stroke.StylusPointsChanged -= OnStrokeStylusPointsChanged; } _inkAnalyzer.AddStrokes(e.NewStrokes); e.NewStrokes.StrokesChanged += OnStrokesChanged; Debug.Assert(e.NewStrokes == this.Strokes); foreach (Stroke stroke in e.NewStrokes) { //listen for StylusPointsChanged, which can happen //during move and resize operations stroke.StylusPointsChanged += OnStrokeStylusPointsChanged; } _inkAnalyzer.BackgroundAnalyze(); }
private void StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e) { Trace.WriteLine("InkCanvas stroke replaced."); }
private void surfaceDessin_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e) { }
protected override void OnStrokesReplaced(InkCanvasStrokesReplacedEventArgs e) { base.OnStrokesReplaced(e); }
private void paint_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e) { }
/// <summary> /// Occurs when strokes are replaced /// Stop the timer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InkCanvas_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e) { ClearStrokes(); }
private void InkCanvas_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e) { textBox.Text += "InkCanvas_StrokesReplaced\n"; }