KeyEventArgs 클래스

정의

가상 키 이벤트에서 반환된 인수를 포함합니다.

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

Windows 요구 사항

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

설명

Windows 10앱은 IME(입력 방법 편집기)가 사용하도록 설정된 경우 이 이벤트를 수신하지 않습니다. IME(입력 메서드 편집기)는 모든 키보드 입력을 처리하고 Handled를true로 설정합니다.

Windows Phone 이 API는 네이티브 앱에서만 지원됩니다.

이 개체는 다음 이벤트 중 하나에 대해 등록된 대리자에서 반환됩니다.

void SetWindow(CoreWindow const & window)
{
    ...
    window.KeyDown({ this, &App::OnKeyDown });
    window.KeyUp({ this, &App::OnKeyUp });
}

// Keypress data is in KeyEventArgs.
void OnKeyDown(Windows::UI::Core::CoreWindow const& /* sender */,
    Windows::UI::Core::KeyEventArgs const& /* args */) {}

void OnKeyUp(Windows::UI::Core::CoreWindow const& /* sender */,
    Windows::UI::Core::KeyEventArgs const& /* args */) {}
// returning keypress events data through KeyEventArgs
void MyCoreWindowEvents::SetWindow( // implementation called by CoreApplication::Run(), provided for context
    _In_ CoreWindow^ window
    )
{
    // ...
    window->KeyDown +=
        ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &CoreWindowEvents::OnKeyDown);
    window->KeyUp +=
        ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &CoreWindowEvents::OnKeyUp);

    // ...
}

참고

이 클래스는 민첩하지 않으므로 스레딩 모델 및 마샬링 동작을 고려해야 합니다. 자세한 내용은 스레딩 및 마샬링(C++/CX)을 참조하세요.

버전 기록

Windows 버전 SDK 버전 추가된 값
1607 14393 DeviceId

속성

DeviceId

이 키 이벤트를 생성한 입력 디바이스의 고유 ID를 가져옵니다.

DeviceId를 사용하여 여러 게임 컨트롤러와 같은 주요 이벤트를 생성할 수 있는 디바이스를 구분합니다.

DeviceId는 모든 입력 디바이스에서 지원되지 않습니다.

Handled

키 누름 이벤트가 처리되었는지 여부를 가져오거나 설정합니다.

KeyStatus

이벤트가 발생할 때 키의 상태 가져옵니다.

VirtualKey

누른 키에 매핑되는 가상 키를 가져옵니다.

적용 대상

추가 정보