private void pic_timer_Tick(object sender, EventArgs e) { if (pictureWriteMode == 1 && time == 0) { pictureWriteMode = 0; String filename = pictureDir.ToString() + "\\Picture_" + DateTime.Now.ToString("yyyy-MM-dd_hhmmssfff") + ".jpg"; frame.SaveImage(filename); SoundPlayer sound = new SoundPlayer(@"sound\shuter.WAV"); sound.Play(); time = 5; CountDown.Enabled = false; CountDown.Visible = false; pic_timer.Enabled = false; } else { opencv_viewer.Controls.Add(CountDown); CountDown.BringToFront(); this.Invoke(new Action(delegate() { pic_timer.Enabled = true; CountDown.Enabled = true; CountDown.Visible = true; CountDown.Text = "" + time; })); time -= 1; } }