PointerPoint 類別

定義

提供與單一滑鼠、畫筆/手寫筆或觸控接觸點相關聯的輸入指標基本屬性。

public ref class PointerPoint sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
class PointerPoint final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
public sealed class PointerPoint
Public NotInheritable Class PointerPoint
繼承
Object Platform::Object IInspectable PointerPoint
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

在下列範例中,我們會使用PointerPoint對象查詢各種指標屬性。

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

備註

PointerPoint 類別會實作 IPointerPoint。

如需可透過 Properties 存取的擴充屬性,請參閱 PointerPointProperties

在大部分情況下,建議您透過所選語言架構中指標事件處理程式的事件自變數取得指標資訊。

如果事件自變數未以內部方式公開應用程式所需的指標詳細數據,您可以透過 PointerRoutedEventArgsGetCurrentPointGetIntermediatePoints 方法來存取擴充指標數據。 使用這些方法來指定指標數據的內容。

靜態 PointerPoint 方法 GetCurrentPointGetIntermediatePoints 一律使用應用程式內容。

注意

這個類別不是敏捷的,這表示您必須考慮其線程模型和封送處理行為。 如需詳細資訊,請參閱線程和封送處理 (C++/CX) 在多線程環境中使用 Windows 執行階段 物件 (.NET)

屬性

FrameId

取得輸入框架的識別碼。

IsInContact

取得值,這個值表示輸入設備 (觸控、手寫筆/手寫筆) 觸碰數位板表面,還是按下滑鼠按鈕。

PointerDevice

取得與輸入指標相關聯之裝置的相關信息。

PointerId

取得輸入指標的唯一標識碼。

Position

取得用戶端座標中指標輸入的位置。

Properties

取得有關輸入指標的擴充資訊。

RawPosition

取得輸入指標的用戶端座標,如輸入設備所報告。

Timestamp

取得輸入發生的時間。

方法

GetCurrentPoint(UInt32)

擷取指定指標的位置和狀態資訊。

在大部分情況下,建議您透過所選語言架構中指標事件處理程式的事件自變數取得指標資訊, (使用 JavaScript、使用 C++、C# 或 Visual Basic 的 UWP 應用程式,或使用 DirectX 搭配 C++ 的 UWP 應用程式) 。

如果事件自變數未以內部方式公開應用程式所需的指標詳細數據,您可以透過 PointerRoutedEventArgsGetCurrentPointGetIntermediatePoints 方法來存取擴充指標數據。 使用這些方法來指定指標數據的內容。

靜態 PointerPoint 方法 GetCurrentPointGetIntermediatePoints 一律使用應用程式內容。

GetCurrentPoint(UInt32, IPointerPointTransform)

擷取指定指標的轉換資訊。

在大部分情況下,建議您透過所選語言架構中指標事件處理程式的事件自變數取得指標資訊, (使用 JavaScript、使用 C++、C# 或 Visual Basic 的 UWP 應用程式,或使用 DirectX 搭配 C++ 的 UWP 應用程式) 。

如果事件自變數未以內部方式公開應用程式所需的指標詳細數據,您可以透過 PointerRoutedEventArgsGetCurrentPointGetIntermediatePoints 方法來存取擴充指標數據。 使用這些方法來指定指標數據的內容。

靜態 PointerPoint 方法 GetCurrentPointGetIntermediatePoints 一律使用應用程式內容。

GetIntermediatePoints(UInt32)

擷取指定指標的位置和狀態資訊,從最後一個指標事件到 目前指標事件為止。

在大部分情況下,建議您透過所選語言架構中指標事件處理程式的事件自變數取得指標資訊, (使用 JavaScript、使用 C++、C# 或 Visual Basic 的 UWP 應用程式,或使用 DirectX 搭配 C++ 的 UWP 應用程式) 。

如果事件自變數未以內部方式公開應用程式所需的指標詳細數據,您可以透過 PointerRoutedEventArgsGetCurrentPointGetIntermediatePoints 方法來存取擴充指標數據。 使用這些方法來指定指標數據的內容。

靜態 PointerPoint 方法 GetCurrentPoint 和 GetIntermediatePoints 一律使用應用程式內容。

GetIntermediatePoints(UInt32, IPointerPointTransform)

擷取指定指標的轉換位置和狀態資訊,從最後一個指標事件到 目前指標事件為止。

在大部分情況下,建議您透過所選語言架構中指標事件處理程式的事件自變數取得指標資訊, (使用 JavaScript、使用 C++、C# 或 Visual Basic 的 UWP 應用程式,或使用 DirectX 搭配 C++ 的 UWP 應用程式) 。

如果事件自變數未以內部方式公開應用程式所需的指標詳細數據,您可以透過 PointerRoutedEventArgsGetCurrentPointGetIntermediatePoints 方法來存取擴充指標數據。 使用這些方法來指定指標數據的內容。

靜態 PointerPoint 方法 GetCurrentPointGetIntermediatePoints 一律使用應用程式內容。

適用於

另請參閱