在uwp中使用ActiveCustomDrying时如何删除InkStroke? [英] How to remove the InkStroke when using the ActiveCustomDrying in uwp?

查看:141
本文介绍了在uwp中使用ActiveCustomDrying时如何删除InkStroke?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了ActiveCustomDrying来定制墨水,现在我想删除它们InkStrokes.由于激活了CustomDrying,所以StrokeContainernull,所以我无法使用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).

The documentation also states that when using ActiveCustomDrying, erasing with InkToolbar does not work automatically and you need to handle the pointer events manually

如果您的应用程序通过自定义的烘干方法覆盖了InkPresenter的默认墨水渲染行为,则渲染的墨水笔触将不再对InkToolbar可用,并且InkToolbar的内置擦除命令将无法正常工作.要提供擦除功能,必须处理所有指针事件,对每个笔划进行命中测试,并覆盖内置的擦除所有墨水"命令.

If your app overrides the default ink rendering behavior of the InkPresenter with a custom drying implementation, the rendered ink strokes are no longer available to the InkToolbar and the built-in erase commands of the InkToolbar do not work as expected. To provide erase functionality, you must handle all pointer events, perform hit-testing on each stroke, and override the built-in "Erase all ink" command.

如果要实现命令,则需要观察工具栏按钮的CheckedUnchecked事件,然后自己处理指针事件.有关如何执行此操作的完整教程,请

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆