PointerDevice 클래스

정의

연결된 포인터 디바이스를 식별하고 해당 기능을 확인하는 기능을 지원합니다.

public ref class PointerDevice sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
class PointerDevice final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.None)]
public sealed class PointerDevice
Public NotInheritable Class PointerDevice
상속
Object Platform::Object IInspectable PointerDevice
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

다음 코드는 PointerDevice를 사용하는 방법을 보여줍니다.

/// <summary> 
/// Invoked when this page is about to be displayed in a Frame. 
/// </summary> 
/// <param name="e">Event data that describes how this page was reached.  The Parameter 
/// property is typically used to configure the page.</param> 
protected override void OnNavigatedTo(NavigationEventArgs e) 
{ 
    string Buffer; 

    Buffer = "List of all pointer devices: \n\n"; 

    var PointerDeviceList = Windows.Devices.Input.PointerDevice.GetPointerDevices(); 
    int displayIndex = 1; 

    foreach (Windows.Devices.Input.PointerDevice PointerDevice in PointerDeviceList) 
    { 
        Buffer += string.Format("Pointer device " + displayIndex + ":\n"); 
        Buffer += string.Format("This pointer device type is " + 
            PointerType(PointerDevice) + "\n"); 
        Buffer += string.Format("This pointer device is " + 
            (PointerDevice.IsIntegrated ? "not " : "") + "external\n"); 
        Buffer += string.Format("This pointer device has a maximum of " + 
            PointerDevice.MaxContacts + " contacts\n"); 
        Buffer += string.Format("The physical device rect is " + 
            PointerDevice.PhysicalDeviceRect.X.ToString() + ", " + 
            PointerDevice.PhysicalDeviceRect.Y.ToString() + ", " + 
            PointerDevice.PhysicalDeviceRect.Width.ToString() + ", " + 
            PointerDevice.PhysicalDeviceRect.Height.ToString() + "\n"); 
        Buffer += string.Format("The screen rect is " + 
            PointerDevice.ScreenRect.X.ToString() + ", " + 
            PointerDevice.ScreenRect.Y.ToString() + ", " + 
            PointerDevice.ScreenRect.Width.ToString() + ", " + 
            PointerDevice.ScreenRect.Height.ToString() + "\n\n"); 
    }  
    PointerOutputTextBlock.Text = Buffer; 
}
#include <sstream>
#include <winrt/Windows.Devices.Input.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.UI.Xaml.Controls.h>
using namespace winrt;
using namespace Windows::Devices::Input;
using namespace Windows::UI::Xaml::Controls;

...

void PointerGetSettings_Click(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args)
{
    auto b{ sender.try_as<Button>() };
    if (b)
    {
        Windows::Foundation::Collections::IVectorView<PointerDevice> pointerDeviceList{ PointerDevice::GetPointerDevices() };
        std::wostringstream buffer;

        for (uint32_t i = 0; i < pointerDeviceList.Size(); i++)
        {
            winrt::hstring displayIndex{ winrt::to_hstring(i + 1) };
            buffer << L"Pointer device " << displayIndex.c_str() << std::endl;
            buffer << L"This pointer device type is ";

            switch (pointerDeviceList.GetAt(i).PointerDeviceType())
            {
            case PointerDeviceType::Mouse:
                buffer << L"Mouse" << std::endl;
                break;
            case PointerDeviceType::Pen:
                buffer << L"Pen" << std::endl;
                break;
            case PointerDeviceType::Touch:
                buffer << L"Touch" << std::endl;
                break;
            default:
                buffer << L"unknown" << std::endl;
            }

            buffer << L"This pointer device is " << (pointerDeviceList.GetAt(i).IsIntegrated() ? L"not " : L"") << L"external" << std::endl;
            buffer << L"This pointer device has a maximum of " << pointerDeviceList.GetAt(i).MaxContacts() << L" contacts" << std::endl;
            buffer << L"The physical device rect is " <<
                pointerDeviceList.GetAt(i).PhysicalDeviceRect().X << L", " <<
                pointerDeviceList.GetAt(i).PhysicalDeviceRect().Y << L", " <<
                pointerDeviceList.GetAt(i).PhysicalDeviceRect().Width << L", " <<
                pointerDeviceList.GetAt(i).PhysicalDeviceRect().Height << std::endl;
            buffer << L"The screen rect is " <<
                pointerDeviceList.GetAt(i).ScreenRect().X << L", " <<
                pointerDeviceList.GetAt(i).ScreenRect().Y << L", " <<
                pointerDeviceList.GetAt(i).ScreenRect().Width << L", " <<
                pointerDeviceList.GetAt(i).ScreenRect().Height << std::endl << std::endl;
        }

        PointerOutputTextBlock().Text(buffer.str());
    }
}
void SDKSample::DeviceCaps::Pointer::PointerGetSettings_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) 
{ 
    Button^ b = safe_cast<Button^>(sender); 
    if (b != nullptr) 
    { 
        Windows::Foundation::Collections::IVectorView<PointerDevice^>^ PointerDeviceList = PointerDevice::GetPointerDevices(); 
        Platform::String^ Buffer; 

        for (unsigned i = 0; i < PointerDeviceList->Size; i++) { 
            Platform::String^ displayIndex = (i + 1).ToString(); 
            Buffer += "Pointer device " + displayIndex + ":\n"; 
            Buffer += "This pointer device type is " + PointerType(PointerDeviceList->GetAt(i)) + "\n"; 
            Buffer += "This pointer device is " + (PointerDeviceList->GetAt(i)->IsIntegrated ? "not " : "") + "external\n"; 
            Buffer += "This pointer device has a maximum of " + PointerDeviceList->GetAt(i)->MaxContacts.ToString() + " contacts\n"; 
            Buffer += "The physical device rect is " + 
                PointerDeviceList->GetAt(i)->PhysicalDeviceRect.X.ToString() + ", " + 
                PointerDeviceList->GetAt(i)->PhysicalDeviceRect.Y.ToString() + ", " + 
                PointerDeviceList->GetAt(i)->PhysicalDeviceRect.Width.ToString() + ", " + 
                PointerDeviceList->GetAt(i)->PhysicalDeviceRect.Height.ToString() + "\n"; 
            Buffer += "The screen rect is " + 
                PointerDeviceList->GetAt(i)->ScreenRect.X.ToString() + ", " + 
                PointerDeviceList->GetAt(i)->ScreenRect.Y.ToString() + ", " + 
                PointerDeviceList->GetAt(i)->ScreenRect.Width.ToString() + ", " + 
                PointerDeviceList->GetAt(i)->ScreenRect.Height.ToString() + "\n\n"; 
        } 

        PointerOutputTextBlock->Text = Buffer; 
    } 
}

설명

여기에 설명된 속성에서 반환되는 값은 연결된 총 포인터 디바이스 수를 기반으로 합니다. 한 디바이스가 특정 기능을 지원하고 숫자 속성이 모든 디바이스에서 노출하는 최대값을 반환하면 부울 속성은 true를 반환합니다.

디바이스 기능 샘플은 입력 디바이스의 존재를 감지하고 각 디바이스의 기능 및 특성을 검색하는 방법을 보여 줍니다.

참고

이 클래스는 민첩하지 않으므로 스레딩 모델 및 마샬링 동작을 고려해야 합니다. 자세한 내용은 스레딩 및 마샬링(C++/CX)다중 스레드 환경에서 Windows 런타임 개체 사용(.NET)을 참조하세요.

속성

IsIntegrated

포인터 디바이스가 통합 디바이스인지 여부를 나타내는 값을 가져옵니다. 예를 들어 외부 펜/스타일러스 디지타이저에 비해 통합 터치 디지타이저가 있는 비디오 디스플레이가 있습니다.

MaxContacts

입력 디바이스에서 지원하는 최대 연락처 수를 나타내는 값을 가져옵니다.

MaxPointersWithZDistance

입력 디바이스에서 지원하는 최대 가리키기 연락처 수를 가져옵니다.

PhysicalDeviceRect

입력 디바이스에서 지원하는 경계 사각형의 좌표를 가져옵니다.

PointerDeviceType

포인터 디바이스 유형을 가져옵니다.

ScreenRect

입력 디바이스에서 지원하는 경계 사각형에 매핑되는 화면 좌표를 가져옵니다.

SupportedUsages

지원되는 포인터 디바이스 사용을 포함하는 컬렉션을 가져옵니다.

메서드

GetPointerDevice(UInt32)

지정된 입력 포인터 ID와 연결된 포인터 디바이스에 대한 정보를 가져옵니다.

GetPointerDevices()

시스템에 연결된 포인터 디바이스에 대한 정보를 가져옵니다.

적용 대상

추가 정보