Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.radioButtonAdd.Checked = true;
- savedFlag = modifyingProgrammatically;
- modifyingProgrammatically = true;
- this.radioButtonAdd.Checked = true;
- modifingProgrammatically = savedFlag;
- if(modifyingProgramatically) {
- // The event was raised by an assignment within the code.
- } else {
- // The event was raised by a user action.
- }
- radioButton.Tag = "ignore"
- radioButton.Checked = true
- private void radioButton_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton.Checked)
- {
- // Tag will be null in cases where the user clicks
- if (this.radioButtonAdd.Tag == null)
- {
- // do something
- }
- else
- {
- // swallow action
- // reset Tag
- this.radioButtonAdd.Tag = null;
- }
- }
- }
- 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;
- }
Add Comment
Please, Sign In to add comment