void checkBox1_N_CheckStateChanged(object sender, EventArgs e) {
checkedListBox1.ItemCheck -= this.CheckedListBox1_ItemCheck;
// Handler body where affecting CheckedListBox1.
checkedListBox1.ItemCheck += this.CheckedListBox1_ItemCheck;
}
相手が更新しているときに、お互いのイベントハンドラーを無効にするのが最適です。
void CheckedListBox1_ItemCheck(object sender, EventArgs e) {
//Find which 'i' is affected.
arrOfCBox[i].cb.CheckStateChanged -= arrOfCBox[i].eh;
// Handler body where affecting checkBox[i].
arrOfCBox[i].cb.CheckStateChanged += arrOfCBox[i].eh;
}
ここで、BoxHandlerは少なくとも次のとおりです。
class BoxHandler
{
public EventHandler eh;
public CheckBox cb;
}
WinFormsに似ています:イベントハンドラーを一時的に無効にしますが、驚くべきことに、それは答えを与えられませんでした(ひどく抽象的すぎますか?)。