问题描述
我使用了ActiveCustomDrying
来定制墨水,现在我想删除它们InkStrokes
.由于激活了CustomDrying
,所以StrokeContainer
是null
,所以我无法使用DeleteSelected
方法删除InkStrokes
.谁能建议我在使用CustomDrying
时如何删除InkStrokes
.
I used the ActiveCustomDrying
to customize the ink, now I want to remove them InkStrokes
. StrokeContainer
is null
because of active the CustomDrying
, so I am unable to remove the InkStrokes
by using the DeleteSelected
method. Can anyone suggest me how to remove the InkStrokes
when using the CustomDrying
.
推荐答案
在自定义干燥期间,您将笔划存储在自定义List<InkStrokeContainer>
集合中:
During the custom drying, you will store the strokes in a custom List<InkStrokeContainer>
collection:
private void InkPresenter_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args)
{
var strokes = _inkSynchronizer.BeginDry();
var container = new InkStrokeContainer();
container.AddStrokes(from item in strokes
select item.Clone());
_strokes.Add(container);
_inkSynchronizer.EndDry();
}
现在您可以手动操作InkStrokeContainer
实例(包括对DeleteSelected
的调用).
Now you can manipulate the InkStrokeContainer
instances manually (including calls to DeleteSelected
).
文档还指出,当使用ActiveCustomDrying
时,使用InkToolbar
进行擦除无法自动进行,您需要手动处理指针事件
The documentation also states that when using ActiveCustomDrying
, erasing with InkToolbar
does not work automatically and you need to handle the pointer events manually
如果要实现命令,则需要观察工具栏按钮的Checked
和Unchecked
事件,然后自己处理指针事件.有关如何执行此操作的完整教程,请在MSDN上可用.
If you want to implement the commands, you will need to observe the Checked
and Unchecked
events of the toolbar buttons and then handle the pointer events yourself. A complete tutorial how to do this is available on MSDN.
这篇关于在uwp中使用ActiveCustomDrying时如何删除InkStroke?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!