PointerPoint PointerPoint PointerPoint PointerPoint PointerPoint Class

Definition

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

public : sealed class PointerPoint : IPointerPoint
struct winrt::Windows::UI::Input::PointerPoint : IPointerPoint
public sealed class PointerPoint : IPointerPoint
Public NotInheritable Class PointerPoint Implements IPointerPoint
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

Remarks

The PointerPoint class implements IPointerPoint.

See PointerPointProperties for extended properties accessible through Properties.

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

If the event argument doesn't intrinsically expose the pointer details required by your app, you can get access to extended pointer data through the GetCurrentPoint and GetIntermediatePoints methods of PointerRoutedEventArgs. Use these methods to specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the app context.

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).

Properties

FrameId FrameId FrameId FrameId FrameId

Gets the ID of an input frame.

public : unsigned int FrameId { get; }
uint32_t FrameId();
public uint FrameId { get; }
Public ReadOnly Property FrameId As uint
var uint = pointerPoint.frameId;
Value
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 IsInContact

Gets a value that indicates whether the input device (touch, pen/stylus) is touching the digitizer surface, or a mouse button is pressed down.

public : Platform::Boolean IsInContact { get; }
bool IsInContact();
public bool IsInContact { get; }
Public ReadOnly Property IsInContact As bool
var bool = pointerPoint.isInContact;
Value
bool bool bool

True if pressed down; false otherwise.

PointerDevice PointerDevice PointerDevice PointerDevice PointerDevice

Gets information about the device associated with the input pointer.

public : PointerDevice PointerDevice { get; }
PointerDevice PointerDevice();
public PointerDevice PointerDevice { get; }
Public ReadOnly Property PointerDevice As PointerDevice
var pointerDevice = pointerPoint.pointerDevice;
Value
PointerDevice PointerDevice PointerDevice

The input device.

PointerId PointerId PointerId PointerId PointerId

Gets a unique identifier for the input pointer.

public : unsigned int PointerId { get; }
uint32_t PointerId();
public uint PointerId { get; }
Public ReadOnly Property PointerId As uint
var uint = pointerPoint.pointerId;
Value
uint uint uint

A unique value that identifies the input pointer.

Position Position Position Position Position

Gets the location of the pointer input in client coordinates.

public : Point Position { get; }
Point Position();
public Point Position { get; }
Public ReadOnly Property Position As Point
var point = pointerPoint.position;
Value
Point Point Point

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

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.

See Also

Properties Properties Properties Properties Properties

Gets extended information about the input pointer.

public : PointerPointProperties Properties { get; }
PointerPointProperties Properties();
public PointerPointProperties Properties { get; }
Public ReadOnly Property Properties As PointerPointProperties
var pointerPointProperties = pointerPoint.properties;
Value
PointerPointProperties PointerPointProperties PointerPointProperties

The extended properties exposed by the input device.

RawPosition RawPosition RawPosition RawPosition RawPosition

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

public : Point RawPosition { get; }
Point RawPosition();
public Point RawPosition { get; }
Public ReadOnly Property RawPosition As Point
var point = pointerPoint.rawPosition;
Value
Point Point Point

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

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.

See Also

Timestamp Timestamp Timestamp Timestamp Timestamp

Gets the time when the input occurred.

public : ulong Timestamp { get; }
ulong Timestamp();
public ulong Timestamp { get; }
Public ReadOnly Property Timestamp As ulong
var ulong = pointerPoint.timestamp;
Value
ulong ulong ulong

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

Methods

GetCurrentPoint(UInt32) GetCurrentPoint(UInt32) GetCurrentPoint(UInt32) GetCurrentPoint(UInt32) GetCurrentPoint(UInt32)

Retrieves position and state information for the specified pointer.

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

If the event argument doesn't intrinsically expose the pointer details required by your app, you can get access to extended pointer data through the GetCurrentPoint and GetIntermediatePoints methods of PointerRoutedEventArgs. Use these methods to specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the app context.

public : static PointerPoint GetCurrentPoint(unsigned int pointerId)
PointerPoint GetCurrentPoint(uint32_t pointerId) const;
public static PointerPoint GetCurrentPoint(UInt32 pointerId)
Public Static Function GetCurrentPoint(pointerId As UInt32) As PointerPoint
var pointerPoint = Windows.UI.Input.PointerPoint.getCurrentPoint(pointerId);
Parameters
pointerId
UInt32 UInt32 UInt32

The ID of the pointer.

Returns

Remarks

GetCurrentPoint is a static method.

See Also

GetCurrentPoint(UInt32, IPointerPointTransform) 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 get pointer info through the event argument of the pointer event handlers in your chosen language framework (Windows app using JavaScript, UWP app using C++, C#, or Visual Basic, or UWP app using DirectX with C++).

If the event argument doesn't intrinsically expose the pointer details required by your app, you can get access to extended pointer data through the GetCurrentPoint and GetIntermediatePoints methods of PointerRoutedEventArgs. Use these methods to specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the app context.

public : static PointerPoint GetCurrentPoint(unsigned int pointerId, IPointerPointTransform transform)
PointerPoint GetCurrentPoint(uint32_t pointerId, IPointerPointTransform transform) const;
public static PointerPoint GetCurrentPoint(UInt32 pointerId, IPointerPointTransform transform)
Public Static Function GetCurrentPoint(pointerId As UInt32, transform As IPointerPointTransform) As PointerPoint
var pointerPoint = Windows.UI.Input.PointerPoint.getCurrentPoint(pointerId, transform);
Parameters
pointerId
UInt32 UInt32 UInt32

The ID of the pointer.

transform
IPointerPointTransform IPointerPointTransform IPointerPointTransform

The transform to apply to the pointer.

Returns

Remarks

GetCurrentPoint is a static method.

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

See Also

GetIntermediatePoints(UInt32) 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 get pointer info through the event argument of the pointer event handlers in your chosen language framework (Windows app using JavaScript, UWP app using C++, C#, or Visual Basic, or UWP app using DirectX with C++).

If the event argument doesn't intrinsically expose the pointer details required by your app, you can get access to extended pointer data through the GetCurrentPoint and GetIntermediatePoints methods of PointerRoutedEventArgs. Use these methods to specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the app context.

public : static IVector<PointerPoint> GetIntermediatePoints(unsigned int pointerId)
IVector<PointerPoint> GetIntermediatePoints(uint32_t pointerId) const;
public static IList<PointerPoint> GetIntermediatePoints(UInt32 pointerId)
Public Static Function GetIntermediatePoints(pointerId As UInt32) As IList<PointerPoint>( Of PointerPoint )
var iVector = Windows.UI.Input.PointerPoint.getIntermediatePoints(pointerId);
Parameters
pointerId
UInt32 UInt32 UInt32

The ID of the pointer.

Returns
IList<PointerPoint> IList<PointerPoint> IList<PointerPoint>

The transformed pointer properties (current and historic).

Remarks

GetIntermediatePoints is a static method.

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

See Also

GetIntermediatePoints(UInt32, IPointerPointTransform) 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 get pointer info through the event argument of the pointer event handlers in your chosen language framework (Windows app using JavaScript, UWP app using C++, C#, or Visual Basic, or UWP app using DirectX with C++).

If the event argument doesn't intrinsically expose the pointer details required by your app, you can get access to extended pointer data through the GetCurrentPoint and GetIntermediatePoints methods of PointerRoutedEventArgs. Use these methods to specify the context of the pointer data.

The static PointerPoint methods, GetCurrentPoint and GetIntermediatePoints, always use the app context.

public : static IVector<PointerPoint> GetIntermediatePoints(unsigned int pointerId, IPointerPointTransform transform)
IVector<PointerPoint> GetIntermediatePoints(uint32_t pointerId, IPointerPointTransform transform) const;
public static IList<PointerPoint> GetIntermediatePoints(UInt32 pointerId, IPointerPointTransform transform)
Public Static Function GetIntermediatePoints(pointerId As UInt32, transform As IPointerPointTransform) As IList<PointerPoint>( Of PointerPoint )
var iVector = Windows.UI.Input.PointerPoint.getIntermediatePoints(pointerId, transform);
Parameters
pointerId
UInt32 UInt32 UInt32

The ID of the pointer.

transform
IPointerPointTransform IPointerPointTransform IPointerPointTransform

The transform to apply to the pointer.

Returns
IList<PointerPoint> IList<PointerPoint> IList<PointerPoint>

The transformed pointer properties (current and historic).

Remarks

GetIntermediatePoints 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 method.

See Also

See Also