Control.OnKeyUp(KeyEventArgs) 메서드

정의

KeyUp 이벤트를 발생시킵니다.

protected:
 virtual void OnKeyUp(System::Windows::Forms::KeyEventArgs ^ e);
protected virtual void OnKeyUp (System.Windows.Forms.KeyEventArgs e);
abstract member OnKeyUp : System.Windows.Forms.KeyEventArgs -> unit
override this.OnKeyUp : System.Windows.Forms.KeyEventArgs -> unit
Protected Overridable Sub OnKeyUp (e As KeyEventArgs)

매개 변수

e
KeyEventArgs

이벤트 데이터를 포함하는 KeyEventArgs입니다.

예제

다음 코드 예제에서는 클래스와 함께 Help 이벤트를 사용하여 KeyUp 사용자에게 팝업 스타일 도움말을 표시합니다.

   // This example demonstrates how to use the KeyUp event with the Help class to display
   // pop-up style help to the user of the application. When the user presses F1, the Help
   // class displays a pop-up window, similar to a ToolTip, near the control. This example assumes
   // that a TextBox control, named textBox1, has been added to the form and its KeyUp
   // event has been connected to this event handler method.
private:
   void textBox1_KeyUp( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e )
   {
      
      // Determine whether the key entered is the F1 key. Display help if it is.
      if ( e->KeyCode == Keys::F1 )
      {
         
         // Display a pop-up help topic to assist the user.
         Help::ShowPopup( textBox1, "Enter your first name", Point(textBox1->Right,this->textBox1->Bottom) );
      }
   }
// This example demonstrates how to use the KeyUp event with the Help class to display
// pop-up style help to the user of the application. When the user presses F1, the Help
// class displays a pop-up window, similar to a ToolTip, near the control. This example assumes
// that a TextBox control, named textBox1, has been added to the form and its KeyUp
// event has been contected to this event handler method.
private void textBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
    // Determine whether the key entered is the F1 key. Display help if it is.
    if(e.KeyCode == Keys.F1)
    {
        // Display a pop-up help topic to assist the user.
        Help.ShowPopup(textBox1, "Enter your first name", new Point(textBox1.Right, this.textBox1.Bottom));
    }
}
' This example demonstrates how to use the KeyUp event with the Help class to display
' pop-up style help to the user of the application. When the user presses F1, the Help
' class displays a pop-up window, similar to a ToolTip, near the control. This example assumes
' that a TextBox control, named textBox1, has been added to the form and its KeyUp
' event has been contected to this event handler method.
Private Sub textBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles textBox1.KeyUp
    ' Determine whether the key entered is the F1 key. Display help if it is.
    If e.KeyCode = Keys.F1 Then
        ' Display a pop-up help topic to assist the user.
        Help.ShowPopup(textBox1, "Enter your first name", New Point(textBox1.Right, Me.textBox1.Bottom))
    End If
End Sub

설명

이벤트가 발생하면 대리자를 통해 이벤트 처리기가 호출됩니다. 자세한 내용은 이벤트 처리 및 발생합니다.

또한 OnKeyUp 메서드를 사용하면 파생 클래스가 대리자를 연결하지 않고도 이벤트를 처리할 수 있습니다. 이는 파생 클래스에서 이벤트를 처리하는 기본 방법입니다.

상속자 참고

파생 클래스에서 OnKeyUp(KeyEventArgs)를 재정의하는 경우 등록된 대리자가 이벤트를 받도록 기본 클래스의 OnKeyUp(KeyEventArgs) 메서드를 호출해야 합니다.

적용 대상

추가 정보