RadioButton.OnCheckedChanged(EventArgs) 메서드

정의

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

protected:
 virtual void OnCheckedChanged(EventArgs ^ e);
protected virtual void OnCheckedChanged (EventArgs e);
abstract member OnCheckedChanged : EventArgs -> unit
override this.OnCheckedChanged : EventArgs -> unit
Protected Overridable Sub OnCheckedChanged (e As EventArgs)

매개 변수

e
EventArgs

이벤트 데이터가 포함된 EventArgs입니다.

예제

다음 코드 예제에서는 런타임에 CheckAlign 속성을 변경할 수 있는 방법을 보여 줍니다. 값이 변경되면 의 RadioButton 검사 상자 부분이 텍스트 Checked 의 오른쪽 또는 왼쪽으로 이동합니다. 이 예제에서는 폼에서 컨트롤을 RadioButton 인스턴스화하고 네임스페이스에 대한 참조를 System.Drawing 포함해야 합니다.

private:
   Void radioButton1_CheckedChanged( System::Object^ sender, System::EventArgs^ e )
   {
      // Change the check box position to be opposite its current position.
      if ( radioButton1->CheckAlign == ContentAlignment::MiddleLeft )
      {
         radioButton1->CheckAlign = ContentAlignment::MiddleRight;
      }
      else
      {
         radioButton1->CheckAlign = ContentAlignment::MiddleLeft;
      }
   }
private void radioButton1_CheckedChanged(Object sender, 
                                         EventArgs e)
{
   /* Change the check box position to 
   be the opposite its current position.*/
   if (radioButton1.CheckAlign == ContentAlignment.MiddleLeft)
   {
      radioButton1.CheckAlign = ContentAlignment.MiddleRight;
   }
   else
   {
      radioButton1.CheckAlign = ContentAlignment.MiddleLeft;
   }
}
Private Sub radioButton1_CheckedChanged(sender As Object, e As EventArgs)
    ' Change the check box position to
    ' be the opposite its current position.
    If radioButton1.CheckAlign = ContentAlignment.MiddleLeft Then
        radioButton1.CheckAlign = ContentAlignment.MiddleRight
    Else
        radioButton1.CheckAlign = ContentAlignment.MiddleLeft
    End If
End Sub

설명

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

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

상속자 참고

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

적용 대상