eatumup eatumup - 1 month ago 8
C# Question

How to make a checkbox button flash?

I have a checkbox shown as button. I want to make it flash when it is checked. From what Ive found, i think the simplest way is to use a timer to rotate the background color of the button.

Where I am stuck is finding the back color of the checked button. Can someone tell me what the back color is changed to by default (via designer) when the button is checked? Without that I cannot get the timer to begin the oscillation.

What I have is a Mute Button. When the mute is active i want the button to flash until it is pressed again to turn the mute off.

In case I'm wrong and the back color actually does not change, what changes about the button to make it appear pressed?


private void checkBox1_CheckedChanged(object sender, EventArgs e)
instructorTimer.Enabled = true;
private void instructorTimer_Tick(object sender, EventArgs e)

// interval is 2000
if (checkBox1.BackColor == System.Drawing.SystemColors.Control)
checkBox1.BackColor = System.Drawing.SystemColors.ControlDark;

checkBox1.BackColor = System.Drawing.SystemColors.Control;


Maybe SystemColors.Control is what you are looking for.

Make sure you have the tick event hooked up. It looks suspect:

private void Form1_Load(object sender, EventArgs e) {
  timer1.Tick += instructorTimer_Tick;

I would also change the color immediately, for instant feedback:

private void checkBox1_CheckedChanged(object sender, EventArgs e)
  checkBox1.BackColor = SystemColors.ControlDark;
  timer1.Enabled = true;