次の方法で共有


RadioButton.CheckedChanged イベント

Checked プロパティの値が変更された場合に発生します。

Public Event CheckedChanged As EventHandler
[C#]
public event EventHandler CheckedChanged;
[C++]
public: __event EventHandler* CheckedChanged;

[JScript] JScript では、このクラスで定義されているイベントを処理できます。ただし、独自に定義することはできません。

イベント データ

イベント ハンドラが EventArgs 型の引数を受け取りました。

解説

イベント処理の詳細については、「 イベントの利用 」を参照してください。

使用例

[Visual Basic, C#, C++] CheckAlign プロパティを実行時に変更する方法を次の例に示します。 Checked 値が変更されると、オプション ボタン コントロールのチェック ボックス部分がテキストの左右に移動します。このコードは、 RadioButton コントロールがフォーム上でインスタンス化されていること、および System.Drawing 名前空間への参照が含まれていることを前提にしています。

 
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


[C#] 
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;
   }
}


[C++] 

private: System::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;
    }
 }
 
};

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

RadioButton クラス | RadioButton メンバ | System.Windows.Forms 名前空間 | Checked | OnCheckedChanged