在UWP中,我使用InkCanvas
来检测笔画。我想更改当前Stroke
的颜色。
我尝试了几个事件,但我只能通过以下事件收集后更改Stroke
的颜色:
InkCanvas.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected
private void InkPresenter_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args)
{
foreach (InkStroke stroke in InkCanvas.InkPresenter.StrokeContainer.GetStrokes())
{
InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
drawingAttributes.Color = Windows.UI.Colors.Blue;
stroke.DrawingAttributes = drawingAttributes;
}
}
我也尝试了StrokeInput
上的事件,但我无法通过这种方式找到当前的笔画。