RadioButton.CheckedChanged イベント

定義

Checked プロパティの値が変更された場合に発生します。Occurs when the value of the Checked property changes.

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

次のコード例は、実行CheckAlign時にプロパティを変更する方法を示しています。The following code example demonstrates how the CheckAlign property can be changed at run time. RadioButtonチェックボックス部分は、値がChecked変更されたときにテキストの右側または左側に移動されます。The check box portion of a RadioButton is moved to the right or left of the text when the Checked value changes. この例では、 RadioButtonコントロールがフォーム上でインスタンス化されていて、 System.Drawing名前空間への参照が含まれている必要があります。This example requires that a RadioButton control has been instantiated on a form and that a reference to the System.Drawing namespace has been included.

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

注釈

イベントの処理の詳細については、「処理とイベントの発生」を参照してください。For more information about handling events, see Handling and Raising Events.

適用対象

こちらもご覧ください