private void b_action_Click(object sender, EventArgs e) { if (b_action.Text == "Обзор") { if (openFileDialog1.ShowDialog() == DialogResult.OK) { pictureBox1.Image = ResizeImg(Image.FromFile(openFileDialog1.FileName), 300, 300); } } else if (b_action.Text == "Снимок") { VideoUtil.CloseVideoSource(); b_action.Text = "Видео"; } else if (b_action.Text == "Видео") { VideoUtil.Start(comboBox1.SelectedIndex - 1); VideoUtil.VideoSource.NewFrame += videoSource_NewFrame; b_action.Text = "Снимок"; } }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { VideoUtil.CloseVideoSource(); }