CharacterReceivedEventArgs 类

定义

提供输入队列接收字符时引发的事件返回的参数。

public ref class CharacterReceivedEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
class CharacterReceivedEventArgs final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
public sealed class CharacterReceivedEventArgs
Public NotInheritable Class CharacterReceivedEventArgs
继承
Object Platform::Object IInspectable CharacterReceivedEventArgs
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

注解

Windows 10启用输入法编辑器 (输入法) 时,应用不会收到此事件。 输入法编辑器 (输入法) 处理所有键盘输入,并将 Handled 设置为 true

Windows Phone此 API 仅在本机应用中受支持。

此对象由为以下事件注册的委托返回:

void SetWindow(CoreWindow const& window)
{
    ...
    window.CharacterReceived({this, &App::OnCharacterReceived });
}

// Character received event data in CharacterReceivedEventArgs.
void OnCharacterReceived(
    Windows::UI::Core::CoreWindow const& /* sender */,
    Windows::UI::Core::CharacterReceivedEventArgs const& /* args */)
{
}
// returning character received events data through CharacterReceivedEventArgs

void MyCoreWindowEvents::SetWindow( // implementation called by CoreApplication::Run(), provided for context
    _In_ CoreWindow^ window
    )
{
    // ...
    window->CharacterReceived +=
        ref new TypedEventHandler<CoreWindow^, CharacterReceivedEventArgs^>(this, &CoreWindowEvents::OnCharacterReceived);
    // ...
}

注意

此类不敏捷,这意味着需要考虑其线程模型和封送处理行为。 有关详细信息,请参阅 线程处理和封送处理 (C++/CX)

属性

Handled

获取或设置是否处理了字符接收的事件。

KeyCode

获取输入队列接收的字符的键代码。

KeyStatus

获取引发字符接收事件的物理按键的状态。

适用于

另请参阅