다음을 통해 공유


방법: Windows Forms Button을 취소 단추로 지정

업데이트: 2007년 11월

모든 Windows Forms에서 Button 컨트롤을 취소 단추로 지정할 수 있습니다. 폼에서 포커스의 위치에 관계없이 Esc 키를 누를 때마다 취소 단추가 클릭됩니다. 일반적으로 어떤 동작 없이 빠르게 작업을 종료할 수 있도록 프로그래밍할 경우 이 단추를 사용합니다.

취소 단추를 지정하려면

  • 폼의 CancelButton 속성을 해당 Button 컨트롤로 설정합니다.

    Private Sub SetCancelButton(ByVal myCancelBtn As Button)
       Me.CancelButton = myCancelBtn
    End Sub
    
    private void SetCancelButton(Button myCancelBtn)
    {
       this.CancelButton = myCancelBtn;
    }
    
    private void SetCancelButton(Button myCancelBtn) 
    {
       this.set_CancelButton(myCancelBtn);
    }
    
    private:
       void SetCancelButton(Button ^ myCancelBtn)
       {
          this->CancelButton = myCancelBtn;
       }
    

참고 항목

작업

방법: Windows Forms 단추 클릭에 응답

방법: Windows Forms 단추를 적용 단추로 지정

개념

Windows Forms Button 컨트롤 선택 방법

참조

Button 컨트롤 개요(Windows Forms)

CancelButton

기타 리소스

Button 컨트롤(Windows Forms)