RadioButton.CheckedChanged Zdarzenie

Definicja

Występuje, gdy wartość Checked właściwości się zmienia.

public:
 event EventHandler ^ CheckedChanged;
public event EventHandler CheckedChanged;
public event EventHandler? CheckedChanged;
member this.CheckedChanged : EventHandler 
Public Custom Event CheckedChanged As EventHandler 

Typ zdarzenia

EventHandler

Przykłady

W poniższym przykładzie kodu pokazano, jak CheckAlign można zmienić właściwość w czasie wykonywania. Część RadioButton pola wyboru jest przenoszona z prawej lub lewej strony tekstu po Checked zmianie wartości. Ten przykład wymaga RadioButton utworzenia wystąpienia kontrolki w formularzu i dołączeniu odwołania do System.Drawing przestrzeni nazw.

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 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 opposite its current position.
    If radioButton1.CheckAlign = ContentAlignment.MiddleLeft Then
        radioButton1.CheckAlign = ContentAlignment.MiddleRight
    Else
        radioButton1.CheckAlign = ContentAlignment.MiddleLeft
    End If
End Sub

Uwagi

Aby uzyskać więcej informacji na temat obsługi zdarzeń, zobacz Obsługa i podnoszenie zdarzeń.

Dotyczy

Zobacz też