1

我还没有找到一种方法来确定手指在屏幕上的压力。获取 StylusPoints 并使用PressureFactor这些点的属性似乎是最明显的:

    private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        var point = e.StylusDevice.GetStylusPoints(Image).Last();
        Debug.WriteLine(point.PressureFactor);

但 PressureFactor 始终为 0.5,从http://msdn.microsoft.com/en-us/library/bb979901(v=vs.95).aspx可以看出,设备类型必须为“Stylus”这工作。

我还查看了用于捕获触摸事件的http://code.msdn.microsoft.com/Multi-Touch-Drawing-744a0b48 。Touch.FrameReported += new TouchFrameEventHandler(Touch_FrameReported);然后事件处理程序可以访问TouchPoints 但它们没有Pressure属性。

如何找到触摸压力?

4

1 回答 1

1

如您在 MSDN的示例代码中所见,仅触控笔支持触控:

 String queryPointer(PointerPoint ptrPt)
 {
     String details = "";

     switch (ptrPt.PointerDevice.PointerDeviceType)
     {
         case Windows.Devices.Input.PointerDeviceType.Mouse:
             details += "\nPointer type: mouse";
             break;
         case Windows.Devices.Input.PointerDeviceType.Pen:
             details += "\nPointer type: pen";
             if (ptrPt.IsInContact)
             {
                 details += "\nPressure: " + ptrPt.Properties.Pressure;
                 details += "\nrotation: " + ptrPt.Properties.Orientation;
                 details += "\nTilt X: " + ptrPt.Properties.XTilt;
                 details += "\nTilt Y: " + ptrPt.Properties.YTilt;
                 details += "\nBarrel button pressed: " + ptrPt.Properties.IsBarrelButtonPressed;
             }
             break;
         case Windows.Devices.Input.PointerDeviceType.Touch:
             details += "\nPointer type: touch";
             details += "\nrotation: " + ptrPt.Properties.Orientation;
             details += "\nTilt X: " + ptrPt.Properties.XTilt;
             details += "\nTilt Y: " + ptrPt.Properties.YTilt;
             break;
         default:
             details += "\nPointer type: n/a";
             break;
     }

....
于 2013-09-20T06:08:05.487 回答