PointerEventArgs Класс

Определение

Содержит аргументы, возвращаемые последним событием указателя.

public ref class PointerEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
class PointerEventArgs final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
public sealed class PointerEventArgs
Public NotInheritable Class PointerEventArgs
Наследование
Object Platform::Object IInspectable PointerEventArgs
Атрибуты
Реализации

Требования к Windows

Семейство устройств
Windows 10 (появилось в 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (появилось в v1.0)

Примеры

void SetWindow(CoreWindow const & window)
{
    window.PointerCursor(Windows::UI::Core::CoreCursor{ CoreCursorType::Arrow, 0 });

    window.PointerPressed({ this, &App::OnPointerPressed });
    window.PointerReleased({ this, &App::OnPointerReleased });
    window.PointerMoved({ this, &App::OnPointerMoved });
}

// Pointer event data in PointerEventArgs.
void OnPointerPressed(Windows::UI::Core::CoreWindow const& /* sender */,
    Windows::UI::Core::PointerEventArgs const& /* args */) {}

void OnPointerReleased(Windows::UI::Core::CoreWindow const& /* sender */,
    Windows::UI::Core::PointerEventArgs const& /* args */) {}

void OnPointerMoved(Windows::UI::Core::CoreWindow const& /* sender */,
    Windows::UI::Core::PointerEventArgs const& /* args */) {}
// returning pointer events data through PointerEventArgs

void MyCoreWindowEvents::SetWindow( // implementation called by CoreApplication::Run(), provided for context
    _In_ CoreWindow^ window
    )
{
    window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0);

    // ...
    window->PointerPressed +=
        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &CoreWindowEvents::OnPointerPressed);
    window->PointerReleased +=
        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &CoreWindowEvents::OnPointerReleased);
    window->PointerMoved +=
        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &CoreWindowEvents::OnPointerMoved);

    // ...
}

Комментарии

Этот объект возвращается делегатом, зарегистрированным для одного из следующих событий:

Примечание

Этот класс не является гибким. Это означает, что необходимо учитывать его модель потоков и поведение маршалинга. Дополнительные сведения см. в разделе Потоки и маршалинг (C++/CX).

Свойства

CurrentPoint

Возвращает данные указателя последнего события указателя.

Handled

Возвращает или задает значение, указывающее, было ли обработано событие указателя.

KeyModifiers

Возвращает клавиши клавиатуры или клавиши, используемые для изменения ввода указателя, например клавиши CTRL при нажатии в сочетании с другой клавишей, как в сочетании с клавишами CTRL+C.

Методы

GetIntermediatePoints()

Извлекает данные указателя для последних 64 расположений указателя с момента последнего события указателя.

Применяется к

См. также раздел