PointerPoint PointerPoint PointerPoint PointerPoint Class

Provides basic properties for the input pointer associated with a single mouse, pen/stylus, or touch contact.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint(System.UInt32) and GetIntermediatePoints(System.UInt32), always use the context of the app.

Syntax

Declaration

public sealed class PointerPointpublic sealed class PointerPointPublic NotInheritable Class PointerPoint

Remarks

The PointerPoint class implements IPointerPoint.

See PointerPointProperties for extended properties accessible through Properties.

Note

: This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Examples

In the following example, we query various pointer properties using a PointerPoint object.

// Get extended pointer data.
function queryPointer(e) {
    // We get the extended pointer info through the getCurrentPoint method
    // of the event argument. (We recommend using getCurrentPoint 
    // to ensure the coordinate space is in relation to the target.)
    // Note: getCurrentPoint and currentPoint are only available in the 
    // local compartment, they are not available in the web compartment.
    var pt = e.getCurrentPoint(e.currentTarget);
    var ptTargetProperties = pt.properties;

    var details = "Pointer Id: " + e.pointerId;
    switch (e.pointerType) {
        case "mouse":
            details += "\nPointer type: mouse";
            details += "\nLeft button: " + ptTargetProperties.isLeftButtonPressed;
            details += "\nRight button: " + ptTargetProperties.isRightButtonPressed;
            details += "\nWheel button: " + ptTargetProperties.isMiddleButtonPressed;
            details += "\nX1 button: " + ptTargetProperties.isXButton1Pressed;
            details += "\nX2 button: " + ptTargetProperties.isXButton2Pressed;
            break;
        case "pen":
            details += "\nPointer type: pen";
            if (pt.isInContact) {
                details += "\nPressure: " + ptTargetProperties.pressure;
                details += "\nrotation: " + ptTargetProperties.rotation;
                details += "\nTilt X: " + ptTargetProperties.tiltX;
                details += "\nTilt Y: " + ptTargetProperties.tiltY;
                details += "\nBarrel button pressed: " + ptTargetProperties.isBarrelButtonPressed;
            }
            break;
        case "touch":
            details += "\nPointer type: touch";
            details += "\nPressure: " + ptTargetProperties.pressure;
            details += "\nrotation: " + ptTargetProperties.rotation;
            details += "\nTilt X: " + ptTargetProperties.tiltX;
            details += "\nTilt Y: " + ptTargetProperties.tiltY;
            break;
        default:
            details += "\nPointer type: " + "n/a";
            break;
    }
    details += "\nPointer location (target): " + e.offsetX + ", " + e.offsetY;
    details += "\nPointer location (screen): " + e.screenX + ", " + e.screenY;

    return details;
}
// Get extended pointer data.
function queryPointer(e) {
    // We get the extended pointer info through the getCurrentPoint method
    // of the event argument. (We recommend using getCurrentPoint 
    // to ensure the coordinate space is in relation to the target.)
    // Note: getCurrentPoint and currentPoint are only available in the 
    // local compartment, they are not available in the web compartment.
    var pt = e.getCurrentPoint(e.currentTarget);
    var ptTargetProperties = pt.properties;

    var details = "Pointer Id: " + e.pointerId;
    switch (e.pointerType) {
        case "mouse":
            details += "\nPointer type: mouse";
            details += "\nLeft button: " + ptTargetProperties.isLeftButtonPressed;
            details += "\nRight button: " + ptTargetProperties.isRightButtonPressed;
            details += "\nWheel button: " + ptTargetProperties.isMiddleButtonPressed;
            details += "\nX1 button: " + ptTargetProperties.isXButton1Pressed;
            details += "\nX2 button: " + ptTargetProperties.isXButton2Pressed;
            break;
        case "pen":
            details += "\nPointer type: pen";
            if (pt.isInContact) {
                details += "\nPressure: " + ptTargetProperties.pressure;
                details += "\nrotation: " + ptTargetProperties.rotation;
                details += "\nTilt X: " + ptTargetProperties.tiltX;
                details += "\nTilt Y: " + ptTargetProperties.tiltY;
                details += "\nBarrel button pressed: " + ptTargetProperties.isBarrelButtonPressed;
            }
            break;
        case "touch":
            details += "\nPointer type: touch";
            details += "\nPressure: " + ptTargetProperties.pressure;
            details += "\nrotation: " + ptTargetProperties.rotation;
            details += "\nTilt X: " + ptTargetProperties.tiltX;
            details += "\nTilt Y: " + ptTargetProperties.tiltY;
            break;
        default:
            details += "\nPointer type: " + "n/a";
            break;
    }
    details += "\nPointer location (target): " + e.offsetX + ", " + e.offsetY;
    details += "\nPointer location (screen): " + e.screenX + ", " + e.screenY;

    return details;
}
function queryPointer(e) {
    /// <summary>
    /// Get extended pointer data.
    /// </summary>
    /// <param name="e" type="Event">The event argument.</param>

    // We get the extended pointer info through the getCurrentPoint method
    // of the event argument. (We recommend using getCurrentPoint 
    // to ensure the coordinate space is in relation to the target.)
    // Note: getCurrentPoint and currentPoint are only available in the 
    // local compartment, they are not available in the web compartment.

    var pt = e.getCurrentPoint(e.currentTarget);
    var ptTargetProperties = pt.properties;

    var details = "Pointer Id: " + e.pointerId;
    switch (e.pointerType) {
        case "mouse":
            details += "\nPointer type: mouse";
            details += "\nLeft button: " + ptTargetProperties.isLeftButtonPressed;
            details += "\nRight button: " + ptTargetProperties.isRightButtonPressed;
            details += "\nWheel button: " + ptTargetProperties.isMiddleButtonPressed;
            details += "\nX1 button: " + ptTargetProperties.isXButton1Pressed;
            details += "\nX2 button: " + ptTargetProperties.isXButton2Pressed;
            break;
        case "pen":
            details += "\nPointer type: pen";
            if (pt.isInContact) {
                details += "\nPressure: " + ptTargetProperties.pressure;
                details += "\nrotation: " + ptTargetProperties.rotation;
                details += "\nTilt X: " + ptTargetProperties.xtilt;
                details += "\nTilt Y: " + ptTargetProperties.ytilt;
                details += "\nBarrel button pressed: " + ptTargetProperties.isBarrelButtonPressed;
            }
            break;
        case "touch":
            details += "\nPointer type: touch";
            details += "\nPressure: " + ptTargetProperties.pressure;
            details += "\nrotation: " + ptTargetProperties.rotation;
            details += "\nTilt X: " + ptTargetProperties.xtilt;
            details += "\nTilt Y: " + ptTargetProperties.ytilt;
            break;
        default:
            details += "\nPointer type: " + "n/a";
            break;
    }
    details += "\nPointer location (target): " + e.offsetX + ", " + e.offsetY;
    details += "\nPointer location (screen): " + e.screenX + ", " + e.screenY;

    return details;
}
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;
    }

    GeneralTransform gt = Target.TransformToVisual(page);
    Point screenPoint;

    screenPoint = gt.TransformPoint(new Point(ptrPt.Position.X, ptrPt.Position.Y));
    details += "\nPointer Id: " + ptrPt.PointerId.ToString() +
        "\nPointer location (parent): " + ptrPt.Position.X + ", " + ptrPt.Position.Y +
        "\nPointer location (screen): " + screenPoint.X + ", " + screenPoint.Y;
    return details;
}
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;
    }

    GeneralTransform gt = Target.TransformToVisual(page);
    Point screenPoint;

    screenPoint = gt.TransformPoint(new Point(ptrPt.Position.X, ptrPt.Position.Y));
    details += "\nPointer Id: " + ptrPt.PointerId.ToString() +
        "\nPointer location (parent): " + ptrPt.Position.X + ", " + ptrPt.Position.Y +
        "\nPointer location (screen): " + screenPoint.X + ", " + screenPoint.Y;
    return details;
}

Properties summary

Gets the ID of an input frame.

Gets a value that indicates whether the physical entity (touch, pen/stylus, or mouse button) is pressed down.

Gets information about the device associated with the input pointer.

Gets a unique identifier for the input pointer.

Gets the location of the pointer input in client coordinates.

Gets extended information about the input pointer.

Gets the raw location of the pointer input in client coordinates.

Gets the time when the input occurred.

Methods summary

Retrieves position and state information for the specified pointer.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint(System.UInt32) and GetIntermediatePoints(System.UInt32), always use the context of the app.

Retrieves the transformed information for the specified pointer.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint(System.UInt32) and GetIntermediatePoints(System.UInt32), always use the context of the app.

Retrieves position and state information for the specified pointer, from the last pointer event up to and including the current pointer event.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint(System.UInt32) and GetIntermediatePoints(System.UInt32), always use the context of the app.

Retrieves the transformed position and state information for the specified pointer, from the last pointer event up to and including the current pointer event.

In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint(System.UInt32) and GetIntermediatePoints(System.UInt32), always use the context of the app.

Properties

  • FrameId
    FrameId
    FrameId
    FrameId

    Gets the ID of an input frame.

    public uint FrameId { get; }public uint FrameId { get; }Public ReadOnly Property FrameId As uint

    Property Value

    • uint
      uint
      uint
      uint

      The frame ID.

    Remarks

    A frame is a collection of input points at a specific instance in time. The frame ID is a common identifier for each input point in the collection.

  • IsInContact
    IsInContact
    IsInContact
    IsInContact

    Gets a value that indicates whether the physical entity (touch, pen/stylus, or mouse button) is pressed down.

    public bool IsInContact { get; }public bool IsInContact { get; }Public ReadOnly Property IsInContact As bool

    Property Value

    • bool
      bool
      bool
      bool

      True if pressed down; false otherwise.

  • PointerDevice
    PointerDevice
    PointerDevice
    PointerDevice

    Gets information about the device associated with the input pointer.

    public PointerDevice PointerDevice { get; }public PointerDevice PointerDevice { get; }Public ReadOnly Property PointerDevice As PointerDevice

    Property Value

  • PointerId
    PointerId
    PointerId
    PointerId

    Gets a unique identifier for the input pointer.

    public uint PointerId { get; }public uint PointerId { get; }Public ReadOnly Property PointerId As uint

    Property Value

    • uint
      uint
      uint
      uint

      A unique value that identifies the input pointer.

  • Position
    Position
    Position
    Position

    Gets the location of the pointer input in client coordinates.

    public Point Position { get; }public Point Position { get; }Public ReadOnly Property Position As Point

    Property Value

    Remarks

    Position contains the client coordinates of the pointer input as interpreted by the system. Under some circumstances, such as input prediction, this data can be modified by the system to compensate for hardware latency or message latency due to inherent delays in sensing and processing the pointer location on the digitizer.

    See RawPosition for information on handling raw input data.

  • Properties
    Properties
    Properties
    Properties

    Gets extended information about the input pointer.

    public PointerPointProperties Properties { get; }public PointerPointProperties Properties { get; }Public ReadOnly Property Properties As PointerPointProperties

    Property Value

  • RawPosition
    RawPosition
    RawPosition
    RawPosition

    Gets the raw location of the pointer input in client coordinates.

    public Point RawPosition { get; }public Point RawPosition { get; }Public ReadOnly Property RawPosition As Point

    Property Value

    Remarks

    RawPosition contains the client coordinates of the input pointer as reported by the input device. Under some circumstances, such as input prediction, this data can be modified by the system to compensate for hardware latency or message latency due to inherent delays in sensing and processing the pointer location on the digitizer.

    See Position for more information on handling modified input data.

  • Timestamp
    Timestamp
    Timestamp
    Timestamp

    Gets the time when the input occurred.

    public ulong Timestamp { get; }public ulong Timestamp { get; }Public ReadOnly Property Timestamp As ulong

    Property Value

    • ulong
      ulong
      ulong
      ulong

      The time, relative to the system boot time, in microseconds.

Methods

  • GetCurrentPoint(System.UInt32)
    GetCurrentPoint(System.UInt32)
    GetCurrentPoint(System.UInt32)
    GetCurrentPoint(System.UInt32)

    Retrieves position and state information for the specified pointer.

    In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

    If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

    The static PointerPoint methods, GetCurrentPoint(System.UInt32) and GetIntermediatePoints(System.UInt32), always use the context of the app.

    public static PointerPoint GetCurrentPoint(System.UInt32 pointerId)public static PointerPoint GetCurrentPoint(System.UInt32 pointerId)Public Static Function GetCurrentPoint(pointerId As System.UInt32) As PointerPoint

    Parameters

    • pointerId
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The ID of the pointer.

    Returns

    Remarks

    GetCurrentPoint(System.UInt32) is a static method.

  • GetCurrentPoint(System.UInt32,Windows.UI.Input.IPointerPointTransform)
    GetCurrentPoint(System.UInt32,Windows.UI.Input.IPointerPointTransform)
    GetCurrentPoint(System.UInt32,Windows.UI.Input.IPointerPointTransform)
    GetCurrentPoint(System.UInt32,Windows.UI.Input.IPointerPointTransform)

    Retrieves the transformed information for the specified pointer.

    In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

    If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

    The static PointerPoint methods, GetCurrentPoint(System.UInt32) and GetIntermediatePoints(System.UInt32), always use the context of the app.

    public static PointerPoint GetCurrentPoint(System.UInt32 pointerId,Windows.UI.Input.IPointerPointTransform transform)public static PointerPoint GetCurrentPoint(System.UInt32 pointerId,Windows.UI.Input.IPointerPointTransform transform)Public Static Function GetCurrentPoint(pointerId As System.UInt32,transform As Windows.UI.Input.IPointerPointTransform) As PointerPoint

    Parameters

    Returns

    Remarks

    GetCurrentPoint(System.UInt32,Windows.UI.Input.IPointerPointTransform) is a static method.

    This method is useful for getting pointer information relative to a specific element.

  • GetIntermediatePoints(System.UInt32)
    GetIntermediatePoints(System.UInt32)
    GetIntermediatePoints(System.UInt32)
    GetIntermediatePoints(System.UInt32)

    Retrieves position and state information for the specified pointer, from the last pointer event up to and including the current pointer event.

    In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

    If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

    The static PointerPoint methods, GetCurrentPoint(System.UInt32) and GetIntermediatePoints(System.UInt32), always use the context of the app.

    public static IVector<PointerPoint> GetIntermediatePoints(System.UInt32 pointerId)public static IVector<PointerPoint> GetIntermediatePoints(System.UInt32 pointerId)Public Static Function GetIntermediatePoints(pointerId As System.UInt32) As IVector( Of PointerPoint )

    Parameters

    • pointerId
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

      The ID of the pointer.

    Returns

    • The transformed pointer properties (current and historic).

    Remarks

    GetIntermediatePoints(System.UInt32) is a static method.

    The most recent pointer information retrieved by this method is equivalent to that retrieved by the GetCurrentPoint(System.UInt32) method.

  • GetIntermediatePoints(System.UInt32,Windows.UI.Input.IPointerPointTransform)
    GetIntermediatePoints(System.UInt32,Windows.UI.Input.IPointerPointTransform)
    GetIntermediatePoints(System.UInt32,Windows.UI.Input.IPointerPointTransform)
    GetIntermediatePoints(System.UInt32,Windows.UI.Input.IPointerPointTransform)

    Retrieves the transformed position and state information for the specified pointer, from the last pointer event up to and including the current pointer event.

    In most cases, we recommend that you obtain pointer info through the pointer event handlers of your chosen Windows 8 language framework (Windows app using JavaScript, Windows Store app using C++, C#, or Visual Basic, or Windows Store app using DirectX with C++).

    If the event argument doesn't expose the pointer details required by your app, you can get access to extended pointer data from the event argument through the getCurrentPoint and getIntermediatePoints methods or currentPoint and intermediatePoints properties. We recommend using the getCurrentPoint and getIntermediatePoints methods as you can specify the context of the pointer data.

    The static PointerPoint methods, GetCurrentPoint(System.UInt32) and GetIntermediatePoints(System.UInt32), always use the context of the app.

    public static IVector<PointerPoint> GetIntermediatePoints(System.UInt32 pointerId,Windows.UI.Input.IPointerPointTransform transform)public static IVector<PointerPoint> GetIntermediatePoints(System.UInt32 pointerId,Windows.UI.Input.IPointerPointTransform transform)Public Static Function GetIntermediatePoints(pointerId As System.UInt32,transform As Windows.UI.Input.IPointerPointTransform) As IVector( Of PointerPoint )

    Parameters

    Returns

    • The transformed pointer properties (current and historic).

    Remarks

    GetIntermediatePoints(System.UInt32,Windows.UI.Input.IPointerPointTransform) is a static method.

    This method is useful for getting pointer information relative to a specific element.

    The most recent pointer information retrieved by this method is equivalent to that retrieved by the GetCurrentPoint(System.UInt32) method.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.UI.Input.dll