【发布时间】:2018-04-04 03:00:41
【问题描述】:
你好我想在inkcanvas上添加一些自定义手势(我做的)功能
但是当 inputdevicetype 是这样的 touch 时,我不知道该怎么做
inkcanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.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;
}
}
当我用 2 个手指按下我的 ink1(inkcanvas) 时,我想使用我的手势功能(绘制字母 L 或点击 inkcanvas 3 次)我所做的
比如uwp的doubletapped,righttapped等
【问题讨论】:
-
“我不能使用任何手势”,你能举个例子吗?
-
例如,我可以通过画一个字母“L”来打开一个图像文件,或者当我用两根手指双击时,我可以在 inkcanvas 上打开一个视频文件。
-
我仍然对您的问题感到困惑。您可以上传一些代码 sn-p,当
inputdevicetype未触摸时可以正常工作。为什么要用 InkCanvas 打开视频文件?