KeyEventArgs.Key 속성

정의

이벤트와 연결된 키보드 키를 가져옵니다.

public:
 property System::Windows::Input::Key Key { System::Windows::Input::Key get(); };
public System.Windows.Input.Key Key { get; }
member this.Key : System.Windows.Input.Key
Public ReadOnly Property Key As Key

속성 값

Key

이벤트에서 참조하는 Key입니다.

예제

다음 예제에서는 를 만들고 KeyEventHandler 와 연결된 KeyEventArgsReturn 키가 키인지 확인합니다.

private void OnKeyDownHandler(object sender, KeyEventArgs e)
{
    if (e.Key == Key.Return)
    {
        textBlock1.Text = "You Entered: " + textBox1.Text;
    }
}
Private Sub OnKeyDownHandler(ByVal sender As Object, ByVal e As KeyEventArgs)
    If (e.Key = Key.Return) Then
        textBlock1.Text = "You Entered: " + textBox1.Text
    End If
End Sub

적용 대상

추가 정보