PointerPoint PointerPoint PointerPoint PointerPoint Class

Definition

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(UInt32) and GetIntermediatePoints(UInt32), always use the context of the app.

public sealed class PointerPointpublic sealed class PointerPointPublic NotInheritable Class PointerPointpublic sealed class PointerPoint
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

FrameId FrameId FrameId FrameId

Gets the ID of an input frame.

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

The frame ID.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 boolpublic bool IsInContact { get; }
Value
bool bool bool bool

True if pressed down; false otherwise.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 PointerDevicepublic PointerDevice PointerDevice { get; }
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 uintpublic uint PointerId { get; }
Value
uint uint uint uint

A unique value that identifies the input pointer.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 Pointpublic Point Position { get; }
Value
Point Point Point Point

The client coordinates, in device-independent pixel (DIP).

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 PointerPointPropertiespublic PointerPointProperties Properties { get; }
Value
PointerPointProperties PointerPointProperties PointerPointProperties PointerPointProperties

The extended properties exposed by the input device.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 Pointpublic Point RawPosition { get; }
Value
Point Point Point Point

The client coordinates, in device-independent pixel (DIP).

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 ulongpublic ulong Timestamp { get; }
Value
ulong ulong ulong ulong

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Methods

GetCurrentPoint(UInt32) GetCurrentPoint(UInt32) GetCurrentPoint(UInt32) GetCurrentPoint(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(UInt32) and GetIntermediatePoints(UInt32), always use the context of the app.

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

The ID of the pointer.

Returns

The pointer property values.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

GetCurrentPoint(UInt32) is a static method.

GetCurrentPoint(UInt32, IPointerPointTransform) GetCurrentPoint(UInt32, IPointerPointTransform) GetCurrentPoint(UInt32, IPointerPointTransform) GetCurrentPoint(UInt32, 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(UInt32) and GetIntermediatePoints(UInt32), always use the context of the app.

public static PointerPoint GetCurrentPoint(UInt32 pointerId, IPointerPointTransform transform)public static PointerPoint GetCurrentPoint(UInt32 pointerId, IPointerPointTransform transform)Public Static Function GetCurrentPoint(pointerId As UInt32, transform As IPointerPointTransform) As PointerPointpublic static PointerPoint GetCurrentPoint(UInt32 pointerId, IPointerPointTransform transform)
Parameters
pointerId
System.UInt32 System.UInt32 System.UInt32 System.UInt32

The ID of the pointer.

Returns

The pointer property values.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

GetCurrentPoint(UInt32, IPointerPointTransform) is a static method.

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

GetIntermediatePoints(UInt32) GetIntermediatePoints(UInt32) GetIntermediatePoints(UInt32) GetIntermediatePoints(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(UInt32) and GetIntermediatePoints(UInt32), always use the context of the app.

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

The ID of the pointer.

Returns

The transformed pointer properties (current and historic).

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

GetIntermediatePoints(UInt32) is a static method.

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

GetIntermediatePoints(UInt32, IPointerPointTransform) GetIntermediatePoints(UInt32, IPointerPointTransform) GetIntermediatePoints(UInt32, IPointerPointTransform) GetIntermediatePoints(UInt32, 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(UInt32) and GetIntermediatePoints(UInt32), always use the context of the app.

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

The ID of the pointer.

Returns

The transformed pointer properties (current and historic).

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

GetIntermediatePoints(UInt32, 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(UInt32) method.