PointerPoint 类

定义

提供与单个鼠标、笔/触笔或触摸触点关联的输入指针的基本属性。

public ref class PointerPoint sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class PointerPoint final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class PointerPoint
Public NotInheritable Class PointerPoint
继承
Object Platform::Object IInspectable PointerPoint
属性

示例

在下面的示例中,我们使用 PointerPoint 对象查询各种指针属性。

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

    switch (ptrPt.PointerDeviceType)
    {
        case PointerDeviceType.Mouse:
            details += "\nPointer type: mouse";
            break;
        case 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 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;
    }

    details += "\nPointer Id: " + ptrPt.PointerId.ToString() +
        "\nPointer location: " + ptrPt.Position.X + ", " + ptrPt.Position.Y;

    return details;
}

注解

有关可通过 Properties 访问的扩展属性,请参阅 PointerPointProperties

PointerPoint 坐标空间取决于检索它的上下文。 从 PointerRoutedEventArgs.GetCurrentPoint 检索时,指针的坐标将相对于提供的 UIElement (以与设备无关的像素为单位)。

属性

FrameId

获取输入帧的 ID。

IsInContact

获取一个值,该值指示输入设备 (触摸、笔/触笔) 按下 (触摸) 数字化器表面,还是按下鼠标按钮。

PointerDeviceType

获取与输入指针关联的输入设备类型。

PointerId

获取输入指针的唯一标识符。

Position

获取输入指针的位置。

Properties

获取有关输入指针的扩展信息。

Timestamp

获取输入发生的时间。

方法

GetTransformedPoint(IPointerPointTransform)

通过使用应用程序定义的转换转换当前 PointerPoint 来检索新的 PointerPoint 对象。

适用于

另请参阅