我正在使用窗體窗體創建一系列單選按鈕programmaticaly。我想創建一個事件,記錄已經選擇了這些無線電之一,如果有,我啓用「確定」按鈕。Windows Form C#「MouseClick」事件在單擊單選按鈕時不會觸發
我有我的事件處理...
protected void Checked_Changed(Object sender, EventArgs e)
{
foreach (Control c in this.Controls)
{
if (c is RadioButton)
{
RadioButton r = (RadioButton)c;
if (r.Checked)
{
this.OK.Enabled = true;
}
}
}
}
但是!問題是我似乎不知道我應該尋找什麼事件來觸發此處理程序。
我嘗試使用
- 點擊
- 鼠標點擊
的MouseUp
this.Click += new System.EventHandler(this.Checked_Changed);
..事件,但,如果我對什麼,但單選按鈕點擊它只能。
我希望你們能幫助我。萬分感謝, 傑克。
很模糊,你清楚做錯了。 「this.Click」是正確的機率非常接近於零。這聽起來像表單的Click事件,而是訂閱單選按鈕的CheckChanged事件。他們全部。 –