Dela via


PointerPointProperties Class

Definition

Provides extended properties for a PointerPoint object.

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, UWP app using C++, C#, or Visual Basic, or UWP 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 and GetIntermediatePoints, always use the context of the app.

public ref class PointerPointProperties sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
class PointerPointProperties final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
public sealed class PointerPointProperties
Public NotInheritable Class PointerPointProperties
Inheritance
Object Platform::Object IInspectable PointerPointProperties
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

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

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 PointerPointProperties class implements IPointerPointProperties.

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

The core of the Microsoft interactive input device architecture is based on the Universal Serial Bus (USB) standard Device Class Definition for Human Interface Device (HID), which is defined by the Implementers Forum, Inc.

The Universal Serial Bus (USB) Human Interface Device (HID) standard defines the configuration and communication protocols for Human Interface Device (HID), such as keyboards, mouse devices, joysticks, and virtual reality devices, that humans use to enter data directly into a computer. (For detailed information about the USB HID standard, see the USB Implementers Forum website.)

Although the core of the Windows input architecture is based on the Universal Serial Bus (USB) Human Interface Device (HID) standard, the architecture is not limited to Universal Serial Bus (USB) devices. The input architecture also supports serial port devices, i8042 port devices, and proprietary input devices.

Properties

ContactRect

Gets the bounding rectangle of the contact area (typically from touch input).

ContactRectRaw

Gets the bounding rectangle of the raw input (typically from touch input).

IsBarrelButtonPressed

Gets a value that indicates whether the barrel button of the pen/stylus device is pressed.

IsCanceled

Gets a value that indicates whether the input was canceled by the pointer device.

IsEraser

Gets a value that indicates whether the input is from a pen eraser.

IsHorizontalMouseWheel

Gets a value that indicates whether the input is from a mouse tilt wheel.

IsInRange

Gets a value that indicates whether the pointer device is within detection range of a sensor or digitizer (the pointer continues to exist).

IsInverted

Gets a value that indicates whether the digitizer pen is inverted.

IsLeftButtonPressed

Gets a value that indicates whether the pointer input was triggered by the primary action mode of an input device.

IsMiddleButtonPressed

Gets a value that indicates whether the pointer input was triggered by the tertiary action mode of an input device.

IsPrimary

Gets a value that indicates whether the input is from the primary pointer when multiple pointers are registered.

IsRightButtonPressed

Gets a value that indicates whether the pointer input was triggered by the secondary action mode (if supported) of an input device.

IsXButton1Pressed

Gets a value that indicates whether the pointer input was triggered by the first extended mouse button (XButton1).

IsXButton2Pressed

Gets a value that indicates whether the pointer input was triggered by the second extended mouse button (XButton2).

MouseWheelDelta

Gets a value (the raw value reported by the device) that indicates the change in wheel button input from the last pointer event.

Orientation

Gets the counter-clockwise angle of rotation around the major axis of the pointer device (the z-axis, perpendicular to the surface of the digitizer). A value of 0.0 degrees indicates the device is oriented towards the top of the digitizer.

PointerUpdateKind

Gets the kind of pointer state change.

Pressure

Gets a value that indicates the force that the pointer device (typically a pen/stylus) exerts on the surface of the digitizer.

TouchConfidence

Gets a value that indicates whether the pointer device rejected the touch contact.

Twist

Gets the clockwise rotation in degrees of a pen device around its own major axis (such as when the user spins the pen in their fingers).

XTilt

Gets the plane angle between the Y-Z plane and the plane that contains the Y axis and the axis of the input device (typically a pen/stylus).

YTilt

Gets the plane angle between the X-Z plane and the plane that contains the X axis and the axis of the input device (typically a pen/stylus).

ZDistance

Gets the z-coordinate (or distance) of the pointer from the screen surface, in device-independent pixels.

Methods

GetUsageValue(UInt32, UInt32)

Gets the Human Interface Device (HID) usage value of the raw input.

HasUsage(UInt32, UInt32)

Gets a value that indicates whether the input data from the pointer device contains the specified Human Interface Device (HID) usage information.

Applies to

See also