You could also do something like changing a flag field value on MouseDown for the radio button, then reverting the flag value on MouseClick. Since the CheckedChanged event fires between the two, it can use the flag before it's reverted by the MouseClick event, and you don't have to worry about resetting its state.
You may still have threading issues to resolve if you're using a field as a flag (don't know much about the application you're working on), but something like this should work:
private bool _mouseEvent;
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (_mouseEvent)
MessageBox.Show("Changed by mouse click.");
else
MessageBox.Show("Changed from code.");
}
private void radioButton1_MouseClick(object sender, MouseEventArgs e)
{
_mouseEvent = false;
}
private void radioButton1_MouseDown(object sender, MouseEventArgs e)
{
_mouseEvent = true;
}
private void button1_Click(object sender, EventArgs e)
{
// This simulates a change from code vs. a change from
// a mouse click.
if (radioButton1.Checked)
radioButton2.Checked = true;
else
radioButton1.Checked = true;
}
Alternately, you could separate your "mouse-click-only" application logic so that it's triggered by a different event (like MouseClick).
Hope this helps.