[C#] CheckBox et différents états coché
Bonjour,
Quelque chose m'intrigue à propos des checkboxes et des ces deux "events" :
CheckedChanged et CheckStateChanged
En lisant la doc, ça n'est déjà pas très clair, tout du moins pour moi :
Citation:
- CheckedChanged :
Occurs when the value of the Checked property changes.
Checked :
Gets or set a value indicating whether the Checkbox is in the checked state.
*****************************************
- CheckSateChanged :
Occurs when the value of the CheckSate property changes.
CheckState :
Gets or sets the state of the CheckBox.
Comme ça n'est pas clair, je met une checkbox sur ma form et met un event handler sur les deux events :
Code:
1 2 3 4 5 6 7 8 9 10
|
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
MessageBox.Show("CheckedChanged");
}
private void checkBox1_CheckStateChanged(object sender, EventArgs e)
{
MessageBox.Show("CheckStateChanged");
} |
En cochant la checkbox, les deux events sont appelés, d'abord CheckedChanged, puis CheckStateChanged. Même chose après avoir décocher la checkbox.
D'où ma question, y'autait-il une différence qui m'aurait échappée entre ces deux events ? Sont-ils en réalité des doublons ?
Merci :D