首先, 你要了解几样东西,stroke 对象, StylusPoint对象 StylusPointCollection集合,比如你可以这样去添加墨迹到InkCanvas上:
StylusPointCollection pts = new StylusPointCollection();
pts.Add(new StylusPoint(10, 10));
pts.Add(new StylusPoint(10, 100));
pts.Add(new StylusPoint(100, 100));
pts.Add(new StylusPoint(100, 10));
pts.Add(new StylusPoint(10, 10));
Stroke s = new Stroke(pts);
s.DrawingAttributes.Color = Colors.Red;
InkCanvas.Strokes.Add(s);
然后,你需要做的就是用Timer去控制添加,比如每隔1秒钟 添加一个StylusPoint对象,参考WPF timer。
Best regards,
Sheldon _Xiao[MSFT]
MSDN Community Support |
Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
![]()