如何在UWP inkcanvas中使用“手势”

如何在UWP inkcanvas中使用“手势”,uwp,gesture,inkcanvas,Uwp,Gesture,Inkcanvas,你好,我想在inkcanvas上添加一些自定义的手势功能 但是我不知道当inputdevicetype是这样触摸时怎么做 inkcanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Touch; 当输入设备类型为touch时,我不能使用任何手势 因为所有的输入都是通过绘制来识别的 当使用带有触摸输入的inkcanvas时,我不能使用手势功能吗 private void ink1_PointerPr

你好,我想在inkcanvas上添加一些自定义的手势功能

但是我不知道当inputdevicetype是这样触摸时怎么做

inkcanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Touch;
当输入设备类型为touch时,我不能使用任何手势

因为所有的输入都是通过绘制来识别的

当使用带有触摸输入的inkcanvas时,我不能使用手势功能吗

private void ink1_PointerPressed(object sender, PointerRoutedEventArgs e)
    {            
            PointerDeviceType pointerDevType = e.Pointer.PointerDeviceType;

            pointers = new Dictionary<uint, Windows.UI.Xaml.Input.Pointer>();

            e.Handled = true;

            PointerPoint ptrPt = e.GetCurrentPoint(ink1);
            m_pt.Add(ptrPt);

            if (!pointers.ContainsKey(ptrPt.PointerId))
            {
                // Add contact to dictionary.
                pointers[ptrPt.PointerId] = e.Pointer;
            }               

            switch (ptrPt.PointerDevice.PointerDeviceType)
            {
                case Windows.Devices.Input.PointerDeviceType.Mouse:                       
                    ink1.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse;
                    ink1.RightTapped += ink1_RightTapped;

                    break;

                case PointerDeviceType.Touch:
                    if (m_pt.Count == 2)
                    {                            
                        ink1.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.None;
                        ink1.RightTapped += ink1_RightTapped;                          


                    }
                    else if (m_pt.Count == 1 || m_pt.Count > 2)
                    {
                        ink1.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Touch;
                        ink1.RightTapped += ink1_RightTapped;

                    }

                break;

            }         


    }
当我用两个手指按下ink1inkcanvas时,我想使用手势功能绘制字母L或轻触inkcanvas三次

例如uwp的双击、右击等。

我看到您使用InkCanvas的PointerPress事件句柄。 InkPresenter的配置决定了InkCanvas的指针事件处理行为。必须将InkPresenter.InputDeviceTypes设置为CoreInputDeviceTypes.None,InkCanvas才能处理指针事件,否则会将它们传递给InkPresenter对象

若要使用InkPresenter对象处理指针事件,必须将RightDragAction设置为LeveUnprocessed,以便将输入作为未处理的输入传递给应用程序进行自定义处理

inkCanvas.InkPresenter.InputProcessingConfiguration.RightDragAction =  InkInputRightDragAction.LeaveUnprocessed;

详细信息请参考。

我不能使用任何手势,你可以举个例子吗?例如,我可以通过画字母L或用两个手指双击打开图像文件,然后我可以在inkcanvas上打开一个视频文件。我仍然对你的问题感到困惑。你可以上传一些代码片段,在inputdevicetype不接触时可以很好地工作。为什么要用InkCanvas打开视频文件?谢谢,我很高兴知道指针事件。而且它只为笔,鼠标输入对吗?不接触input@Kay,这个答案意味着如果您的输入类型是笔或触摸,您应该按照上面提到的设置。其中包含触摸输入。